我在尝试将 Vuejs 2 + Vue Router 2 + Laravel 5.3 与 webpack 一起使用时遇到错误!
这是我的代码:
我的index.html
<div id="app">
<router-view></router-view>
</div>
我的app.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import Map from './map'
Vue.use(VueRouter);
const router = new VueRouter({
routes: Map
});
new Vue({
router,
render: h => {
return h(App)
}
}).$mount('#app');
我的App.vue
<template>
<router-view></router-view>
</template>
<script>
export default {
name: 'App',
}
</script>
这样就会出现以下错误:
You are using the runtime-only build of Vue where the template option is not available. Either pre-compile the templates into render functions, or use the compiler-included build.
如果我将 Vue 导入更改为:
从“vue”导入 Vue
到
从“vue/dist/vue.js”导入 Vue
效果很好!
有人知道怎么解决吗?
最佳答案
伙计们,我认为这与 laravel-elixie-vue 包有关!
我与 Anderson 合作,我们安装了一个新的 laravel 版本,它附带了新的包 laravel-elixir-vue-2 并解决了问题!
当我们更新软件包时,Vedovelli 和 Vinicius 的评论都可以正常工作!
谢谢
关于webpack - Vue 2 + VueRouter 2 + Laravel 5.3 - Webpack(运行时 x 独立构建问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39876064/