如何将绑定变量传递给子组件?

时间:2018-04-22 11:05:04

标签: vue.js vue-component

我有一个Vue组件调用另一个组件,传递一些道具:

<template>
  <div id="weather">
      <weather-part class="night" from="0" to="8" data="data"></weather-part>
  </div>
</template>

<script>
import weatherPart from "./weatherPart.vue"
export default {
    name: 'weather',
    components: {
        "weather-part": weatherPart
    },
    data() {
        return {
            data: {'a': 1, 'b': 2}
        }
    },
    mounted() {
        // the place where this.data is actually initialized
    }
}
</script>

问题是传递给data道具的是字符串"data"(与开发工具的Vue插件一起检查)。

如何传递this.data的值?(可能是序列化字符串)

0 个答案:

没有答案