Vue-router is introduced through CDN. How to use it?

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content=" width=device-width,user-scalable=no">
<meta content="telephone=no,address=no,email=no" name="format-detection"> 
<title>vue</title>
<meta name="keywords" content="" />
<meta name="description" content=""/>
<script src="https://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<script type=text/javascript>
(function(win) {
    var doc = win.document;
    var docEl = doc.documentElement;
    var tid;
    function refreshRem() {
        var width = docEl.getBoundingClientRect().width;
        if (width > 750) {
            width = 750;
        }
        var rem = width / 7.5; 
        docEl.style.fontSize = rem + "px";
    }
    win.addEventListener("resize", function() {
        clearTimeout(tid);
        tid = setTimeout(refreshRem, 300);
    }, false);
    win.addEventListener("pageshow", function(e) {
        if (e.persisted) {
            clearTimeout(tid);
            tid = setTimeout(refreshRem, 300);
        }
    }, false);
    refreshRem();
})(window);
</script>
</head>
<body>
<div id="app">
  

{{ message }}

<a @click="move" v-if="isLogin"></a> <router-link to="/home">Go to Foo</router-link> </div> <script> new Vue({ el: "-sharpapp", data: { message: "Hello Vue.js!", isLogin:false }, methods:{ move(){ console.log("ddd") } } }) </script> </body> </html>

how to add vue-router to a page like this html

May.07,2021


Vue.use(Router)
const router=new Router({
  mode: 'history',
  //base: process.env.BASE_URL,
  routes: [
    ...
  ]
})
new Vue({
  router,
  el: '-sharpapp',
  data: {
    message: 'Hello Vue.js!',
    isLogin:false
  },
  methods:{
      move(){
          console.log('ddd')
      }
  }
})

and vue scaffolding is the essence of vue. It is recommended to use @ vue/cli to create a project

Menu