嵌套VueJS组件

时间:2016-05-20 18:17:01

标签: javascript vue.js

我想尝试在我的vue文件中嵌套组件:

父级正在实现组件GISDispatches.vue。这应该在母版页中稍后表示一个表。因此,为了测试整个事情,我想看看这些方法是如何一起工作的。我希望在这个设置中,调用子方法loadDispatchTable并返回控制台输出。

组件父

<script>
    import GISDispatches from '../components/GISDispatches.vue';

    export default {
        template: require('../templates/map.html'),

        components: {
            gisdispatches: GISDispatches
        },

        events: {
            MapsApiLoaded: function() {
                this.loadDispatchTable;
            }
        }
    }
}
</script>

组件子级 - GISDispatches.vue

<script>

    export default {
        template: require('../templates/GISDispatches.html'),

        data() {
            return {
                dispatches: ''
            }
        },

        computed: {
        },

        events: {
        },

        methods: {
            loadDispatchTable: function() {
                console.log("OK");
            }
        }
}
</script>

但是控制台输出没有出现,页面仍按预期加载。我需要更改设置吗?

0 个答案:

没有答案