python web全栈,  python全栈,  前端开发

12.用户列表-通过路由的形式展现用户列表

新建一个Users的组件文件,通过子路由的方式将Users 做为home主页的子页面

  • 新建Users.vue
<template>
    <div>
        <h3>用户列表组件</h3>
    </div>
</template>

<script>
    export default {
        name: "Users"
    }
</script>

<style scoped>

</style>
  • 关键代码

router.js

import Users from "./components/Users";

{
            path: '/home',
            component: Home,
            redirect: '/welcome',
            children: [{path: '/welcome',component: Welcome}, {path: '/users',component: Users}], //注意这里是一个数组[]

        }

file

留言

您的电子邮箱地址不会被公开。 必填项已用*标注

闽ICP备20008591号-1