能獲取到資料 資料卻渲染不到頁面上
問題描述: 我資料全部拿到了,js 里面寫 console.log( musics ) 資料列印出來都正確,但是頁面里面就是不顯示,
很多時候對資料進行處理了,但是頁面上就是沒變化,沒效果,用 console.log 列印資料都沒問題,特別是陣列、物件容易出現這個問題;
1、 this.$set( xxx )
保存變數
2、this.$forceUpdate( xxx )
強制更新,迫使 Vue 實體重新渲染,注意它僅僅影響實體本身和插入插槽內容的子組件,而不是所有子組件,
另外:另外變數名別沖突,如下這種憨p情況
<script>
export default {
name: 'xxx',
props: {
musics: {
type: Array,
default () {
return []
}
}
},
data () {
return {
musics:[]
}
}
</script>
解決辦法:
將 js 代碼 data 中 musics:[ ] 洗掉,
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/222745.html
標籤:其他
上一篇:frpc使用
下一篇:這是今天真正的大事:RCEP
