weexteam / vue-precompiler-for-apache-weex

vue-precompiler-for-apache-weex is a third party plugin, and is not developed nor maintained by Apache Weex.
MIT License
4 stars 7 forks source link

Not support for style binding with methods. #2

Closed MrRaindrop closed 6 years ago

MrRaindrop commented 6 years ago

Currently not support binding style with methods like :style="someMethod()". Here's a example:

<template>
  <div>
    <text :style="testStyleMthod()">TEST TEST</text>
  </div>  
</template>

<script>
  export default {
    methods: {
      testStyleMthod () {
        return { fontSize: '30px'}
      }
    }
  }
</script>

The substitute for this is using computed values instead of methods:

<template>
  <div>
    <text :style="testStyleValue">TEST TEST</text>
  </div>  
</template>

<script>
  export default {
    computed: {
      testStyleValue () {
        return { fontSize: '30px'}
      }
    }
  }
</script>
MrRaindrop commented 6 years ago

https://github.com/weexteam/weex-vue-render/issues/9

MrRaindrop commented 6 years ago

https://github.com/weexteam/weex-vue-precompiler/commit/d5303967eabcefee67ffb9dcc16c98285d0fa285 has added multiple cases for this style-binding expression. Here's the typical supported cases: https://github.com/weexteam/weex-vue-precompiler/blob/master/test/input/hooks/style-binding.vue