Open bobSir opened 4 years ago
<template> <pages-layout > <text v-for="i in message" :key="i" class="greeting">{{i}}</text> </pages-layout> </template> <script> import PagesLayout from './test.vue'; export default { name: 'home', components: { PagesLayout, }, data() { return { message: undefined, }; }, created(){ console.log("00000"); }, mounted() { console.log("11111"); }, }; </script> <style scoped> .greeting { text-align: center; font-size: 50px; color: #0091fa; background: blueviolet; } </style>
<template> <div> <slot></slot> </div> </template> <script> export default { name: 'Layout', created() { console.log("@cly --11 "+this.$parent); // this.$set(this.$parent, 'message', [...new Array(10)].map((item, i) => i)); }, mounted(){ console.log("@cly --22 "+this.$parent); this.$set(this.$parent, 'message', [...new Array(10)].map((item, i) => i)); } }; </script>
0.20 版本渲染正常, 0.28.0 weex sdk 是否修改了组件渲染机制