search

Home  >  Q&A  >  body text

javascript - Click event of custom component cannot be triggered

HTML:
<p id="zuj">

<router-link to="/home">home</router-link>
<router-link to="/details">details</router-link>
<router-view></router-view>

</p>
<p id="sss">

<p @click="dds()">{{index}}{{message}}</p>

</p>

JS:
vuerouter: function () {

    new Vue({
        el: '#sss',
        data:{
                index:1,
                message:"sb"
        },
        methods:{
            dds:function () {
                alert(1);
                this.index=2;
            }
        },
        computed:{
            blcontlist:function () {
                alert(1)
            }
        }
    });
    var Home = {
        template: '#sss',
    };
    var details = {
        template: '<p>文章详情页</p>'
    };
    // 配置路由
    var jump = [{
        path: '/details',
        component: details
    },{
        path: '/home',
        component: Home
    }];
    // 创建实例
    var router = new VueRouter({
        routes: jump
    });
    // 挂载实例
    var app = new Vue({
        el: '#zuj',
        router: router
    })
}


.native也试过了不行。
黄舟黄舟2794 days ago492

reply all(1)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-19 10:21:56

    Can anyone help?

    reply
    0
  • Cancelreply