Vue hangs a function in prototype to show that the call to refresh on another page is undefined, but jumping from another page to the called page does not report an error.

vue hangs a function in prototype to refresh another page and shows that the call is undefined, but jumping from another page to the called page does not report an error

Jan.25,2022

just put the code in which you modify the prototype before the Vue instantiation.


try this one

const logged = function() {...}
Object.defineProperty(Vue.prototype, 'logged', {value: logged })

if you do not visit this page, your prototype chain code will not be executed. Of course, it cannot be accessed. Please put it in main.js


should have executed the created function before it reached the prototype stage.

try to put prototype in the header, under the vue reference, and the problem should be solved.

Menu