Hanks10100 / weex-native-directive

Weex native directive design
67 stars 14 forks source link

Support to use filters #13

Open Hanks10100 opened 6 years ago

Hanks10100 commented 6 years ago

Using callbacks to support filters in the template.

<text>{{ item.title | i18n }}</text>

Should be compiled to:

{
  type: 'text',
  attrs: {
    value: {
      '@binding': 'item.title'
      '@filters': [i18n]
   }
}

The i18n is a function, and it'll be converted into a callback id when sending to native. Native render engines should get the value of item.title and pass it to the callbacks which are defined in @filters.