gpt4 book ai didi

javascript - Vuejs : You are mounting an instance with a template to ``

转载 作者:搜寻专家 更新时间:2023-10-30 22:56:09 25 4
gpt4 key购买 nike

我收到以下错误:

vue.common.js?e881:987

[Vue warn]: You are mounting an instance with a template to <body>. This will replace entirely. You should probably use replace: false here.

我正在使用 vue-webpack模板和 vue-router:

这是我的 main.js :

var Vue = require('vue');
var VueRouter = require('vue-router');

var App = require('./App');

Vue.use(VueRouter);

var router = new VueRouter();

router.map({
});

router.start(App, 'body');

所以,我应该在哪里写选项 replace: false

App.vue :

<template>
The site title is:{{html_title}}
<div>
<input v-model="parentMsg"/>
<br/>

<p>{{ parentMsg }}</p>
</div>
</template>

<script>
export default {
props: ['html_title'],
components: {},
data: function () {
return {
parentMsg: 'test'
};
}
}
</script>

最佳答案

App.vue 应该有选项 replace: false

<script>
export default {
replace: false,
props: ['html_title'],
components: {},
data: function () {
return {
parentMsg: 'test'
};
}
}
</script>

关于javascript - Vuejs : You are mounting an instance with a template to `<body>` ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36673922/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com