繁体   English   中英

为什么不存在 vue 组件渲染?

[英]Why a non existent vue component rendering?

为什么要渲染这个 Vue 模板? h(App2),但 App2 不存在? 怎么了? 非常感谢你的帮助。

索引.html

<body>
    <div id="app"></div>
</body>

应用0.vue

    <template>
        <div>
            Hi there!
        </div>
    </template>

    <script>
        export default {
            name: "App1"
        }
    </script>

main.js

import Vue from 'vue';
import App2 from './App0';


new Vue({
     el: '#app',
     render: h =>  h(App2)
});

只需添加components选项:

new Vue({
     el: '#app',
     components: { App2 },
     render: h =>  h(App2)
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM