Fourth, vue-router programmatic routing (and vue-cli turn off Eslint verification)

vue-router programmatic routing

Programmatic routing is to realize page jump by writing js code.

① Write a div in the test.vue component and add a click event.

$router.push('name'); or $router.push({path:'name'}); These two methods are equivalent.

②Create goods.vue under the view folder and its content:

③Introduce the goods component in index.js under the router folder.

④Enter cmd to run the command npm run dev, and enter localhost:8080/#/test into the browser

Then click on the bottom "click to jump...page" to jump to:



Vue-cli turns off Eslint verification

Projects built by vue-cli scaffolding often report eslint check errors. After cmd runs the command npm run dev, an error occurs.

Error message:

Turn off the Eslint authentication method:

Find webpack.base.conf.js under the build folder and open it, comment out the following code:

Turn off Eslint verification, and re-enable it to remove code comments.




Guess you like

Origin blog.csdn.net/li__po/article/details/80480694