Define vuejs component in blade

    <div class="general_wrapper" id="profile">
                <div class="nav_menu">
                        <li :class="{'active': tab==0}" @click="tabSelect(0)">
                        <li :class="{'active': tab==1}" @click="tabSelect(1)">
        const profile = new Vue({
            el: '#app',
            data: {
                tab: 0
            methods: {
                tabSelect(id) {
           = id;

I need this bunch of code inside my project. I don't know what wrong with it. I got this error:

Property or method "tab" is not defined on the instance but referenced during render.

I removed 'const app = new Vue({ el: '#app'});' from app.js it works, but I have another Vue component in my project, and this made another one unknown...



You need to define a container for you app

For eg.

<div id="app"> 
  Inside your vue component

so you can defina a vue component that use the container used in el setting

el: '#app',

maybe you will have some problem between blade and vue tags {{}}. Maybe you will can use @{{}} to specify vue vars


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.