美文网首页
app.$mount("#app") 手动挂载

app.$mount("#app") 手动挂载

作者: 翌凌枫 | 来源:发表于2019-05-29 15:22 被阅读0次
    $mount()手动挂载
    当Vue实例没有el属性时,则该实例尚没有挂载到某个dom中;
    假如需要延迟挂载,可以在之后手动调用vm.$mount()方法来挂载。例如:
     
    new Vue({
    //el: '#app',
    router,
    render: h => h(App)
    // render: x => x(App)
    // 这里的render: x => x(App)是es6的写法
    // 转换过来就是:  暂且可理解为是渲染App组件
    // render:(function(x){
    //  return x(App);
    // });
    }).$mount("#app");
     
    或者
    new Vue({
    el: '#app',
    router,
    render: h => h(App)
    // render: x => x(App)
    // 这里的render: x => x(App)是es6的写法
    // 转换过来就是:  暂且可理解为是渲染App组件
    // render:(function(x){
    //  return x(App);
    // });
    });
    

    相关文章

      网友评论

          本文标题:app.$mount("#app") 手动挂载

          本文链接:https://www.haomeiwen.com/subject/dgsytctx.html