原来写法:
props: { fileId: { type: String, } }, watch: { 'fileId': function (value) { this.getFileInfo(value) } }
更改后:
props: { fileId: { type: String, } }, watch: { 'fileId':{ immediate:true, handler:function(value){ this.getFileInfo(value) } } }
Vue 官方文档: