封裝餓了嗎element-ui的timepicker時候出現如下錯誤:
[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "value" (found in ) warn @ vue.js?1a2a:564 (anonymous) @ vue.js?1a2a:2699 reactiveSetter @ vue.js?1a2a:864 updateChildComponent @ vue.js?d304:2468 prepatch @ vue.js?d304:3343 patchVnode @ vue.js?d304:5136 updateChildren @ vue.js?d304:5064 patchVnode @ vue.js?d304:5147 updateChildren @ vue.js?d304:5064 patchVnode @ vue.js?d304:5147 updateChildren @ vue.js?d304:5064 patchVnode @ vue.js?d304:5147 updateChildren @ vue.js?d304:5064 patchVnode @ vue.js?d304:5147 updateChildren @ vue.js?d304:5064 patchVnode @ vue.js?d304:5147 updateChildren @ vue.js?d304:5064 patchVnode @ vue.js?d304:5147 patch @ vue.js?d304:5271 Vue._update @ vue.js?d304:2303 updateComponent @ vue.js?d304:2419 get @ vue.js?d304:2756 run @ vue.js?d304:2826 flushSchedulerQueue @ vue.js?d304:2595 (anonymous) @ vue.js?d304:658 nextTickHandler @ vue.js?d304:605 vue.js?1a2a:564 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "readonly" (found in )
#封裝程式碼如下:
时间
使用如下:
當點擊時間控制選擇時間的時候,就會報錯,不點擊沒問題。
求大神幫看下如何封裝帶有v-model的組件。
這種錯誤是vue2.0裡有的,意思是你修改了父元件傳來得值,你已經使用data代替了,所以不是這個地方出的問題,難道是傳到elementUI時出的問題?你不給date賦值dateValue,用目前頁面自己定義的資料呢?還會有這個問題嗎?