为什么这个 Vue 模板渲染?h(App2(,但 App2 不存在?怎么了?非常感谢您的帮助。
索引.html
<body>
<div id="app"></div>
</body>
App0.vue
<template>
<div>
Hi there!
</div>
</template>
<script>
export default {
name: "App1"
}
</script>
主.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)
});