Vue inline template not finding methods or data

杀马特。学长 韩版系。学妹 提交于 2019-12-20 02:56:29

问题


Normally using Vue as an out of the box solution with Laravel so it just 'works'.

I am adding it now to a WordPress build but have an issue with an inline template.

Every looks fine, but it will not do anything in the mounted method and says that any data or methods are undefined, almost likes its not properly loading the component.

Here is the basic HTML:

<tabbed-panels class="component tabPanels" inline-template>
    <div>
        <div class="tabPanels__controls-control" v-on:click="changeTab(1)"></div>
    </div>
</tabbed-panels>

tabbed-panels.js:

export default {
    data() {
        return {
            activeTab: null
        }
    },
    methods: {
        changeTab(id) {
            this.activeTab = id;
        }
    },
    ready() {
        console.log('foo');
    } 
}

Import statement:

Vue.component('tabbed-panels', require('./tabbed-panels.js'));

Any idea where this could be going wrong? Normal single file .vue components work fine but not possible for the content.

来源:https://stackoverflow.com/questions/48189020/vue-inline-template-not-finding-methods-or-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!