Laravel&Vue警告问题

时间:2019-05-29 04:38:54

标签: css laravel vue.js

我从事过Laravel&Vue js项目。

这是Laravel代码

代码运行良好,但在开发人员模式(检查)中出现警告

Laravel视图代码

@extends('layouts/app')

@section('content')

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

@endsection

app.js 代码

const router = new VueRouter({ mode: 'history', routes: routes});
const app = new Vue(Vue.util.extend({ router }, App)).$mount('#app');


app.js:74791 [Vue warn]: Cannot find element: #app
warn @ app.js:74791
query @ app.js:79817
./node_modules/vue/dist/vue.common.dev.js.Vue.$mount @ app.js:86018
./resources/js/app.js @ app.js:86329
__webpack_require__ @ app.js:20
0 @ app.js:86576
__webpack_require__ @ app.js:20
(anonymous) @ app.js:84
(anonymous) @ app.js:87
app.js:74791 [Vue warn]: Property or method "single" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

---> <Overlap> at resources/js/components/OutwardComponent.vue
       <Root>

1 个答案:

答案 0 :(得分:0)

您需要引用Vue的div应该在布局文件中, Vue初始化后,div可能正在渲染。 将<div id="app"></div>放入layouts/app文件中,查看其是否消失。