[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]: Invalid prop: type check failed for prop "unlinkPanels". Expected Boolean, got String with value "true".VueAIBooleanGo
- vue報錯:[Vue warn]: Invalid prop: type check failed for prop "value". Expected Number, got String....VueAIGo
- vue專案報錯[Vue warn]: Property “visible“ must be accessed with “$data.visible“ because properties startVue
- efcore This MySqlConnection is already in useMySql
- Uncaught SyntaxError: Identifier 'Geometry' has already been declaredErrorIDE
- [Vue warn]: Error in render: "TypeError: Cannot read property 'matched' of undefined" found in <App> at src/App.vueVueErrorUndefinedAPP
- Redis 啟動報錯Address already in useRedis
- 1364 - Field did doesnt have a default value
- kafka java.rmi.server.ExportException: Port already in useKafkaJavaServerExportException
- 解決 eclipse出現 Address already in use: bindEclipse
- vue專案啟動報錯(SyntaxError: Identifier ‘__vite__injectQuery’ has already been declared (at ${mod.id}:55030:1))VueErrorIDEVite
- vue---Prop使用Vue
- 解決nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)NginxAI
- How to update BOL entity property value via ABAP code
- Property "visible" must be accessed with "$data.visible"
- [Vue warn]: $attrs is readonly;Webpack externals 配置VueWeb
- spring.jackson.default-property-inclusion 不生效問題分析Spring
- 錯誤解決:Attempting to use uninitialized value VariableZed
- [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.explicit_defaults_for_timestamp
- xxl-job 報:java.net.BindException: Address already in use: bindJavaIndexException
- Warning: ORA-16792: configurable property value is inconsistent with member sett
- vue-property-decoratorVue
- use azure data studio to create external table for oracleOracle
- 2.3.1.1.3 Application Containers Use Case: Logical Data WarehouseAPPAI
- [Vue] Use render functionVueFunction
- Property "visible" must be accessed with "$data.visible" because properties
- Result Maps collection already contains value for xxx.xxx.dao.BaseResultMap錯誤AI
- 解決mybatis出現Mapped Statements collection already contains value for問題MyBatisAPPAI
- PostgreSQL DBA(115) - pgAdmin(Don't do this:Don't use varchar(n) by default)SQL
- 屬性font-family:Font property font-family does not have generic default
- vue實現prop雙向繫結Vue
- Cannot set property ‘type‘ of null(vue)NullVue
- mysql-timestamp 0000-00-00 00:00:00 Invalid default valueMySql
- Vue元件中prop屬性使用說明Vue元件
- vue之prop,emit資料傳遞示例VueMIT
- Result Maps collection already contains value for com.xxx.xxxMapper.BaseResultMap問題解決AIAPP
- Vue.use(plugin)詳解VuePlugin
- Vue.use 原始碼分析Vue原始碼