fix(vue-app): re-register components construtor in HMR (#9539)

* fix(vue-app): re-register components construtor in HMR

* simpilify checking
This commit is contained in:
Xin Du (Clark) 2021-07-12 11:21:04 +01:00 committed by GitHub
parent 356de80e7d
commit a3b2fd86ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -735,6 +735,13 @@ function hotReloadAPI(_app) {
let $components = getNuxtChildComponents(_app.<%= globals.nuxt %>, [])
$components.forEach(addHotReload.bind(_app))
if (_app.context.isHMR) {
const Components = getMatchedComponents(router.currentRoute)
Components.forEach((Component) => {
Component.prototype.constructor = Component
})
}
}
function addHotReload ($component, depth) {