小编Tes*_*ter的帖子

如何从组件外部销毁vue.js组件

我已经在vuejs中创建了一个这样的组件

    var tree_data = Vue.extend({
        template: '#tree_data_template',
        props: [
            'groupmodal',
            'search-name',
            'tree-id'
        ], // props in single quotes
        data: function () {
            return {
                shared: d2d.store
            };
        }
    });
Run Code Online (Sandbox Code Playgroud)

并在另一个这样的模板中使用此组件。

var template_data = Vue.extend({
template: '#template_data',
created: function () {
    var self = this;
    self.shared.setCurrentRoute('templates');
},
components: {
    'tree-data': tree_data
},
data: function () {
    return {
        id: this.$route.params.id,
        shared: d2d.store,
    };
},
methods: {
    destroyComponent: function () {
        //Need to code for destroy tree-data component
    }
}
});
Run Code Online (Sandbox Code Playgroud)

刀片文件代码 …

components vue.js

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

components ×1

vue.js ×1