Vue Js中未呈现数据

问题描述 投票:0回答:1
 I am new in Vue.js,I have tried to render data to home page but nothing displayed despite of no error.Here is my code

// app.js从'./components/Home'导入Home;

const routes = [{ name: 'home',path: '/home',component: Home},];

const router = new VueRouter({ mode: 'history', routes: routes});

const app = new Vue(Vue.util.extend({ router },{data: {message:'Hello Vue!'}}, Home)).$mount('#app');

// Home.vue

{{消息}}

laravel vue.js
1个回答
0
投票

为了呈现您提供的HTML内容,您必须告诉vue的起点。这样做是这样的

您的代码

import Home from './components/Home';

const routes = [{ name: 'home',path: '/home',component: Home},];

const router = new VueRouter({ mode: 'history', routes: routes});

const app = new Vue(Vue.util.extend({ router },{data: {message:'Hello Vue!'}}, Home)).$mount('#app');

HTML

<div id="app">
<p>{{ message }}</p>
</div>
© www.soinside.com 2019 - 2024. All rights reserved.