[Vue warn]: The data property "dialogVisible" is already declared as a prop. Use prop default value
在使用Vue開發中,使用元件時報了這麼一個錯誤:
[Vue warn]: The data property "dialogVisible" is already declared as a prop. Use prop default value
翻譯過來就是:
資料屬性“dialogVisible”已經宣告為一個prop。使用prop預設值代替。
經過查詢是在元件傳值時,傳遞過來了一個 dialogVisible,但是在data方法中同時也定義了一個 dialogVisible,
檢視原始碼後是這樣:
大致思路就是:訪問data 和methods中的資料之外,還訪問了props元件傳遞過來的值,如果發現data資料欄位中的key值已經被定義,那麼props傳的引數再有這個重名的key值就會報這個錯誤。
props的訪問優先順序是 > data中的優先順序 > menthods中的優先順序
代表,如果在這個key值在props中出現,那麼data中的key值就不能定義了。
這樣兩個地方就重複宣告瞭,
所以,解決方案:把return 中宣告的刪掉就可以
相關文章
- 怎樣解決 [Vue warn]: The computed property "count" is already defined in data. 報錯問題?Vue
- vue報錯:[Vue warn]: Invalid prop: type check failed for prop "value". Expected Number, got String....VueAIGo
- [Vue warn]: Invalid prop: type check failed for prop "unlinkPanels". Expected Boolean, got String with value "true".VueAIBooleanGo
- vue專案報錯[Vue warn]: Property “visible“ must be accessed with “$data.visible“ because properties startVue
- [Vue warn]: Error in render: "TypeError: Cannot read property 'matched' of undefined" found in <App> at src/App.vueVueErrorUndefinedAPP
- Uncaught SyntaxError: Identifier 'Geometry' has already been declaredErrorIDE
- efcore This MySqlConnection is already in useMySql
- vue.js 中 data, prop, computed, method,watch 介紹Vue.js
- vue---Prop使用Vue
- 函式引數的 Default value函式
- react.js:3640 Warning: Each child in an array or iterator should have a unique "key" prop. Check the...ReactJS
- kafka java.rmi.server.ExportException: Port already in useKafkaJavaServerExportException
- Oracle Database on NFS : unable to lock file - already in use" ErrorOracleDatabaseNFSError
- How to update BOL entity property value via ABAP code
- use the function_based index to access the null valueFunctionIndexNull
- vue-property-decoratorVue
- vue專案啟動報錯(SyntaxError: Identifier ‘__vite__injectQuery’ has already been declared (at ${mod.id}:55030:1))VueErrorIDEVite
- Redis 啟動報錯Address already in useRedis
- [Vue warn]: $attrs is readonly;Webpack externals 配置VueWeb
- d3d11 effect state and default value tables3D
- vue原始碼解析-prop機制Vue原始碼
- How to: Use Resources to Set Property Values in Web Server ControlsWebServer
- java.net.bindexception:address already in use: connectJavaIndexException
- 錯誤解決:Attempting to use uninitialized value VariableZed
- 解決 eclipse出現 Address already in use: bindEclipse
- Address already in use: JVM_Bind:80 解決方案JVM
- java.net.BindException: Address already in use: JVM_BindJavaIndexExceptionJVM
- vue實現prop雙向繫結Vue
- Mybatis Data truncation: Truncated incorrect DOUBLE value: '*'MyBatis
- Cannot set property ‘type‘ of null(vue)NullVue
- Warning: ORA-16714: the value of property ArchiveLagTarget is inconsistentHive
- Default Value Insertion and Integrity Constraint Checking (164)AI
- spring.jackson.default-property-inclusion 不生效問題分析Spring
- 解決svnserve: Can't bind server socket: Address already in useServer
- Vue元件中prop屬性使用說明Vue元件
- vue之prop,emit資料傳遞示例VueMIT
- Default Data Type Mappings Used by Oracle SQL DeveloperAPPOracleSQLDeveloper
- Vue-Property-Decorator原始碼分析Vue原始碼