Where is the router.beforeEach written when the project built by vue-cli sets the title for each page?

clipboard.png

clipboard.png

reported that there is no definition for router. May I ask why?

Mar.19,2021

write under main.js


look at your code and put it all in the js file of routing configuration. Your router is not defined. Of course, you report undefined when you use it. The correct posture is to put router.beforeEach in main.js. Of course, first of all, you need to import router from 'xxx/index.js', in main.js, that is, introduce your routing profile


suggest putting it in main.js, and then your route is also injected into-sharpapp


.

first of all, look at the case clearly. router is not defined.

you should be copied code from somewhere else.
that file is import router from 'router.js'

in main.js .

so this router is actually your export default going out new Router ()

.

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3edee-2b18e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3edee-2b18e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?