Hanks10100 / weex-native-directive

Weex native directive design
67 stars 14 forks source link

Parse object literal in binding attributes or styles #11

Open Hanks10100 opened 6 years ago

Hanks10100 commented 6 years ago

Source:

<div :style="{ fontSize: 15, color: item.color }"></div>

Should be compiled to:

{
  style: {
    fontSize: 15,
    color: { '@binding':  'item.color' }
  }
}

Current is:

{
  style: {
    '@binding':  '{ fontSize: 15, color: item.color }'
  }
}
yyx990803 commented 6 years ago

We can use acorn to parse and transform the expression.