Framework 7 Vue - 运行Parent Vue的方法不起作用

问题描述 投票:0回答:1

我已经尝试了很多不同的方法从父vue运行一个简单的功能,但仍然没有工作,console.log没有错误但没有任何事情发生...任何人请帮我看看这个...非常感谢。

app.vue

import childpage from './child.vue';
export default {
    data() {
        return {
            f7params: {
              name: 'myapp',
              id: 'com.myapp.fn',
              theme : 'ios',
              routes: [
                  {
                    path: '/childpage/',
                    component: childpage,
                  },
        }
    },
    events:{
        fn : 'runfn',
    },
    methods: {
        runfn(){
            console.log('HERE!!!');
        }
    },
    components: {
        childpage,
    }
}

child.vue

export default {
    data() {
        return {
            isBottom: true,
        };
    },
    mounted: function(){
        this.runfn();
    },
    methods: {
        runfn(){ 
            this.$emit('fn');
        }
    }
}
vue.js methods html-framework-7
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.