Vue does not use vue-cli to introduce router, there is a problem that functions are not recognized.

I tried to separate the vue-router stuff, but I misreported it.

clipboard.png

main.js
router vue

index.html

clipboard.png
main.js

clipboard.png
router.js

clipboard.png

is that router reported an error, which is fine in main.js, but it is not possible to separate it alone.

Mar.21,2021

notice that the router,vue-router under new vue in mainjs is for vue. If it is not attached to the vue instance, it will report an error


the answer is solved. It is the reason for export default {}, and {} should not be added.

Menu