TypeError: Cannot redefine property When back to same Component by VueRoute
See original GitHub issuevue-property-decorator@8.3.0
I have the problem when using the ProvideReactive with VueRouter always get the “TypeError: Cannot redefine property:” when back to the same Component at Second time
I am very sure the component is Destoryed at first time and I am not using the <keeplive /> or something else like that
maybe use the “hasOwnProperty” before defineProperty ?
if (
!rv[reactiveInjectKey].hasOwnProperty(provide.managedReactive[i])
) {
Object.defineProperty(
rv[reactiveInjectKey],
provide.managedReactive[i],
{
enumerable: true,
get: function() {
return _this[i];
},
},
);
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Vuejs - Uncaught TypeError: Cannot redefine property: $router
Solved! In my index.html file, I had imported vue again: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" ...
Read more >[Solved]-Vue-Router returns "Cannot redefine property
Coding example for the question Vue-Router returns "Cannot redefine property: $router" error-Vue.js.
Read more >TypeError: Cannot redefine property: $router - Vue Forum
... vue component package that uses vue router in abstract mode, i get an error saying: Reason: TypeError: Cannot redefine property: $router.
Read more >FAQ - qiankun - UmiJS
Try to set the webpack output.library of the broken sub app the same with your ... Vue Router Error - Uncaught TypeError: Cannot...
Read more >Possible reasons for " Cannot redefine property " Error ?
app.js:48343 Uncaught TypeError: Cannot redefine property: $router at Function ... components/dashboard.vue' // Router const router = new VueRouter({ routes ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/kaorun343/vue-property-decorator/issues/277#issuecomment-558594655
Here is the solution. set
inject: []
in Component optionsSame here, configuration
Edit: This issue happens in the latest
v8.3.0
, but works fine inv8.2.1
for now just fix it to that version to have something working 😃