vue+element tabs选项卡分页

超、凢脫俗 2023-10-09 11:19 143阅读 0赞

文件目录:

20190925103313470.png

功能展示:

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zODQwNDg5OQ_size_16_color_FFFFFF_t_70

20190925105324903.png

路由配置:

  1. {
  2. path: '/account',
  3. component: ()=> import('../components/home/home.vue'), //布局页面
  4. redirect: '/account/all-account/list', //定向到list路径
  5. name: '账号管理',
  6. children: [
  7. {
  8. path: '/account/all-account/list',
  9. redirect: '/account/all-account/staff', //定向到staff路径
  10. name: '员工管理',
  11. component: () => import('../components/view/account/index.vue'),
  12. children: [
  13. {
  14. path: '/account/all-account/staff',
  15. component: () => import('../components/view/account/account.vue'),
  16. hidden: true
  17. },
  18. {
  19. path: '/account/all-account/agent',
  20. name: '代理人账号',
  21. component: () => import('../components/view/account/agent.vue'),
  22. hidden: true
  23. },
  24. {
  25. path: '/account/all-account/department',
  26. name: '部门设置',
  27. component: () => import('../components/view/account/department.vue'),
  28. hidden: true
  29. },
  30. {
  31. path: '/account/all-account/role',
  32. name: '角色权限设置',
  33. component: () => import('../components/view/account/role.vue'),
  34. hidden: true
  35. },
  36. {
  37. path: '/account/all-account/city',
  38. name: '城市管理',
  39. component: () => import('../components/view/account/city.vue'),
  40. hidden: true
  41. },
  42. ]
  43. },
  44. }

组件代码:

index.vue

  1. <template>
  2. <div class="page_container" style="overflow:auto;height:100%;background: #ffffff;padding: 10px;min-width:1200px;">
  3. <router-view />
  4. </div>
  5. </template>

account.vue

  1. <template>
  2. <!-- 账号管理tab分页 -->
  3. <div id="employeeCareMng" class="page_container" style="overflow:auto;height:100%;background: #ffffff;min-width:1200px;">
  4. <div v-if="isNative" >
  5. <div style="height:100%;">
  6. <el-tabs v-model="activeName" style="height:100%;" @tab-click="handleClick">
  7. <el-tab-pane label="员工账号" name="first" style="height:100%;">
  8. <staff/>
  9. </el-tab-pane>
  10. <el-tab-pane label="代理人账号" name="second" style="height:100%;">
  11. <agent/>
  12. </el-tab-pane>
  13. <el-tab-pane label="部门设置" name="third" style="height:100%;">
  14. <department/>
  15. </el-tab-pane>
  16. <el-tab-pane label="角色权限设置" name="fourth" style="height:100%;">
  17. <role/>
  18. </el-tab-pane>
  19. <el-tab-pane label="城市管理" name="fifth" style="height:100%;">
  20. <city/>
  21. </el-tab-pane>
  22. </el-tabs>
  23. </div>
  24. </div>
  25. <div v-else style="height:100%;">
  26. <router-view />
  27. </div>
  28. </div>
  29. </template>
  30. <script>
  31. import staff from './staff'
  32. import agent from './agent'
  33. import department from './department'
  34. import role from './role'
  35. import city from './city'
  36. export default {
  37. components: {
  38. staff,agent,department,role,city
  39. },
  40. data() {
  41. return {
  42. isNative: true,
  43. activeName: 'first' //默认先渲染第一个
  44. }
  45. },
  46. //页面初始默认是第一个板块展示
  47. created() {
  48. if (this.$route.path === '/account/all-account/staff') {
  49. this.isNative = true
  50. } else {
  51. this.isNative = false
  52. }
  53. },
  54. methods: {
  55. handleClick(tab, event) {
  56. console.log(tab, event)
  57. }
  58. }
  59. }
  60. </script>
  61. <style scoped>
  62. .page_container{
  63. background: #ffffff;
  64. height: 100%;
  65. }
  66. </style>
  67. <style >
  68. #employeeCareMng .el-tabs__content {
  69. height:calc(100% - 55px);
  70. }
  71. </style>

其他tabs分页的组件:

staff.vue 其他类似

  1. <template>
  2. <div class="staff">
  3. 员工账号
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name:"staff",
  9. data(){
  10. return {
  11. }
  12. },
  13. created(){
  14. },
  15. methods: {
  16. },
  17. };
  18. </script>
  19. <style scoped>
  20. </style>

发表评论

表情:
评论列表 (有 0 条评论,143人围观)

还没有评论,来说两句吧...

相关阅读

    相关 tab选项

    tab选项卡 tab选项卡 tab选项卡可以说是一个可以在一个·规定的位置中可以嵌套多个页面或小页面,也可以说是一本笔记本可以有很多张纸,那么多纸都封装在笔记本里面,可以