JavaScript/vue.js/error2:修订间差异
来自康健生活
创建页面,内容为“== 标题文字 == * <nowiki>The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for e…” |
|||
| (未显示同一用户的10个中间版本) | |||
| 第1行: | 第1行: | ||
== 标题文字 == | == 标题文字 == | ||
* <nowiki>The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.</nowiki> | * <nowiki>The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.</nowiki> | ||
*: 原因是我在标签中使用了 <code>v-if</code>,同时标签又和其他标签平级 | |||
*: <syntaxhighlight lang="html5"> | |||
... | |||
<el-button | |||
v-if="!userToken" | |||
type="primary">+ 关注</el-button> | |||
<div class="user-head__follow-box clear-fix"> | |||
<div class="tag"> | |||
...</syntaxhighlight> | |||
*: 这时需要将使用 <code>v-if</code> 的标签用一个容器包裹起来(随便什么标签都可以),问题即可解决 | |||
*: <syntaxhighlight lang="html5"> | |||
... | |||
<el-row> | |||
<el-button | |||
v-if="!userToken" | |||
type="primary">+ 关注</el-button> | |||
</el-row> | |||
<div class="user-head__follow-box clear-fix"> | |||
<div class="tag"> | |||
...</syntaxhighlight> | |||
*: 另外,如果使用了 <code>v-html</code> 并且在服务端渲染了,也会抛出这个错误,可以使用 <code><client-only></client-only></code> 包裹解决 | |||
* Invalid prop: type check failed for prop "index". Expected String with value "0", got Number with value 0. | |||
*: 格式警告,需要字符串,但是传入的是 number 类型数据 | |||
* Maximum call stack size exceeded | |||
*: 超出最大调用堆栈大小 | |||
* [vue-router] Duplicate named routes definition: | |||
*: 路由命名的name属性重复 | |||
* use a data or computed property based on the prop's value. Prop being mutated | |||
*: prop 是单向绑定,不能更改数据,只能由父组件传输过来 | |||
* You may have an infinite update loop in a component render function | |||
*: 函数内更改了 data 的值触发重新渲染,每一次触发都是一个新的值变化,进一步重新渲染,所以死循环 | |||
*: 在 v-for 循环当中,如果用方法或者计算属性对 vm.$data 的属性进行操作,理论上,可能因为修改到循环对象,诱发无限循环。 | |||