我似乎无法访问mounted
函数中的道具。
这是我呈现它的方式:
{{landing}}
<vue-date-selector-comp v-bind:publishedat="landing.published_at" v-bind:cr="landing.created"></vue-date-selector-comp>
这是我的组件代码:
vue.component('vue-date-selector-comp', {
props: ['publishedat', 'cr'],
template: '<div class="vue-date-selector-comp-cont">{{cr}}</div>',
mounted: function() {
console.log('publishedat1', this.publishedat);
console.log('created2', this.cr);
this.$nextTick(function () {
console.log('publishedat', this.publishedat);
console.log('created', this.cr);
});
}
});
我只在控制台中看到undefined
...为什么?当我在组件呈现之前{{landing}}时 - &gt;我可以看到数据存在。我做错了什么?