zoukankan      html  css  js  c++  java
  • 056——VUE中vue-router之路由参数的验证处理保存路由安全

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>vue-router之路由参数的验证处理保存路由安全</title>
        <script src="vue.js"></script>
        <script src="vue-router.js"></script>
    </head>
    <body>
    <div id="demo">
        <router-link to="/content">链接</router-link>
        <br/>
        <router-view></router-view>
    </div>
    <script type="text/x-template" id="content">
        <div>
            id:{{$route.params.id}}
            <br/>
            <button @click="show">点击效果</button>
        </div>
    </script>
    <script>
        const content = {
            template: "#content",
            methods: {
                show() {
                    console.log(this.$route.params);
                }
            }
        }
        let routes = [
            {path: '/content/:id(\d{2})', component: content}
        ]
        let router=new VueRouter({routes});
        new Vue({
            el: "#demo",
            router
        });
    </script>
    </body>
    
    </html>
    

      

  • 相关阅读:
    寒假学习第九天
    寒假学习第八天
    寒假学习第七天
    寒假学习第六天
    寒假学习第五天
    寒假学习第四天
    寒假学习第三天
    寒假学习第二天
    寒假学习第一天
    阅读笔记
  • 原文地址:https://www.cnblogs.com/yiweiyihang/p/8296775.html
Copyright © 2011-2022 走看看