我有以下文件夹结构:
- 上市
- 索引.html
- 登录.html
- 源代码
- 组件(包含 Login.vue)
- 意见
- 应用程序.vue
- main.js
index.html 有以下片段:
<div id="app"></div>
login.html 有以下片段:
<div id="login"></div>
在 main.js 中,我有以下内容:
import Vue from 'vue'
import './components'
import './plugins'
import { sync } from 'vuex-router-sync'
import App from './App'
import router from '@/router'
import store from '@/store'
import Login from './components/Login'
sync(store, router)
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
new Vue({
router,
store,
render: h => h(Login) ===> I've tried here also "template: Login" and el: '#login' instead of 'mount' but to no avail
}).$mount('#login')
虽然这适用于 index.html,但它不适用于 login.html。