问答详情
源自:4-4 单页面应用 Demo2(1)

那个add什么时候添加到router.js里面了?

那个add什么时候添加到router.js里面了?感觉视频不完整,跟着撸的代码的url中一直有个#,不知道是不是视频漏掉的部分

提问者:gfsmxn 2019-02-24 17:20

个回答

  • qq_慕工程1049718
    2019-05-23 23:14:49

    {

    path: '/add',

    name: 'add',

    component: Add

    },

    自己写上,用户界面还要添加跳转add页按钮,这些省了

    <template>

    <div>

    <button type="button" @click="addItems()">添加</button>

    <p>user</p>

    </div>

    </template>


    <script>

    export default {

    name: 'User',

    methods: {

    addItems () {

    this.$router.push('/add')

    }

    },

    }

    </script>


    <style scoped>


    </style>