1、問題展示:
其一、報(bào)錯(cuò)的代碼信息為:Invalid prop: type check failed for prop "label". Expected String with value "30", got Number with value 30.
中文翻譯:無效的道具:道具“標(biāo)簽”的類型檢查失敗。 預(yù)期值為“30”的字符串,得到值為 30 的數(shù)字。
其二、報(bào)錯(cuò)的頁面顯示為:
其三、想要的結(jié)果:
在 table
表格標(biāo)題欄能顯示 1-31 的數(shù)字
(字符型)
2、原因分析:
看到提示,肯定是設(shè)置的字符類型
有問題;
(即:設(shè)置的字符類型為數(shù)字類型
,而所需要的類型為字符類型
)
3、解決過程:
其一、 將 :label= "item.label"
修改為 :label= "item.label+''"
即可;
A、修改前
的代碼為:
<el-table-column
v-for="(item,index) in tableAllData"
:key="index"
:label= "item.label"
width="60">
<template slot-scope="scope">{{ scope.row.date }}
</template>
</el-table-column>
B、修改后
的代碼為:
<el-table-column
v-for="(item,index) in tableAllData"
:key="index"
:label= "item.label+''"
width="60">
<template slot-scope="scope">{{ scope.row.date }}
</template>
</el-table-column>
其二、代碼截圖為:
文章來源:http://www.zghlxwxcb.cn/news/detail-647780.html
4、小結(jié):
其一、哪里有不對或不合適的地方,還請大佬們多多指點(diǎn)和交流!
其二、有興趣的話,可以多多關(guān)注這個(gè)專欄(Vue(Vue2+Vue3)面試必備專欄):https://blog.csdn.net/weixin_43405300/category_11525646.html?spm=1001.2014.3001.5482
文章來源地址http://www.zghlxwxcb.cn/news/detail-647780.html
到了這里,關(guān)于解決:Invalid prop:Expected String with value “30“, got Number with value 30.的問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!