账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    vue配置的这几种写法有什么区别?
    38
    0

    vue配置这几种写法有什么区别?有点懵:

    第1种:vue-cli 3.0 的main.js里面是这样写的:

    new Vue({
      router,
      store,
      render: h => h(App)
    }).$mount("#app");
    
    

    第2种:网上一篇博客是这样写的

    new Vue({
        el: '#app',
        router,
        axios,
        store,
        apolloProvider,
        template: '<App/>',
        components: { App }
    });
    
    

    第3种:vue-apollo里面是这样写的:https://akryum.github.io/vue-...

    new Vue({
      el: '#app',
      provide: apolloProvider.provide(),
      render: h => h(App),
    })
    

    第4种:百度lavas的app.js中没有new Vue(),但有下面一段: 文档 https://github.com/lavas-proj...

    export function createApp() {
        let router = createRouter();
        let store = createStore();
        let App = Vue.extend({
            router,
            store,
            ...AppComponent
        });
        return {App, router, store};
    }
    
    
    
    

    问题:

    1、第1种和第3种写法里面有一句render: h => h(App),这个语句是什么意思?h是什么东西?
    2、第2种写法里面有下面两句,表示什么意思?

    template: '<App/>',
    components: { App }

    3、第2种写法里面有一句apolloProvider,,第3种写法里面有一句provide: apolloProvider.provide(),两个有什么区别?

    4、第4种百度lavas的写法看不懂,请大神帮解释一下。

    谢谢各位大神先!

    1
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 夏未凉♬ 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部