Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js Vue组件不';如果转移到具有'v-if'的父组件中,则无法连接` <div v-component="child"> <div v-component="transcluded"></div> </div>_Vue.js - Fatal编程技术网

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
,它会起作用