Vue.js Vue组件不';如果转移到具有'v-if'的父组件中,则无法连接` <div v-component="child"> <div v-component="transcluded"></div> </div>
小提琴: 父组件Vue.js Vue组件不';如果转移到具有'v-if'的父组件中,则无法连接` <div v-component="child"> <div v-component="transcluded"></div> </div>,vue.js,Vue.js,小提琴: 父组件 <div v-component="child"> <div v-component="transcluded"></div> </div> 转移成分 var globals = {}; var transcludedComponent = Vue.extend({ template: "<div>blarg</div>", compiled: function () {
<div v-component="child">
<div v-component="transcluded"></div>
</div>
转移成分
var globals = {};
var transcludedComponent = Vue.extend({
template: "<div>blarg</div>",
compiled: function () {
globals.el = this.$el;
// globals.el ends up inside a #document-fragment
},
attached: function () {
alert('attached');
}
});
var globals={};
var transcludedComponent=Vue.extend({
模板:“布拉格”,
编译:函数(){
globals.el=这个。$el;
//globals.el最终出现在一个#文档片段中
},
附:函数(){
警报(“附件”);
}
});
已转置的组件在DOM中呈现,但不会触发attached
事件
var globals = {};
var transcludedComponent = Vue.extend({
template: "<div>blarg</div>",
compiled: function () {
globals.el = this.$el;
// globals.el ends up inside a #document-fragment
},
attached: function () {
alert('attached');
}
});
如果v-If=“visible”
被删除,则一切正常
我是不是用错了,还是这是一个bug?如果您使用
v-show
而不是v-if
,它会起作用