vue+element tabs選項卡分頁效果
本文實例為大家分享了vue+element tabs選項卡分頁效果的具體代碼,供大家參考,具體內(nèi)容如下
文件目錄:

功能展示:


路由配置:
{
path: '/account',
component: ()=> import('../components/home/home.vue'), //布局頁面
redirect: '/account/all-account/list', //定向到list路徑
name: '賬號管理',
children: [
{
path: '/account/all-account/list',
redirect: '/account/all-account/staff', //定向到staff路徑
name: '員工管理',
component: () => import('../components/view/account/index.vue'),
children: [
{
path: '/account/all-account/staff',
component: () => import('../components/view/account/account.vue'),
hidden: true
},
{
path: '/account/all-account/agent',
name: '代理人賬號',
component: () => import('../components/view/account/agent.vue'),
hidden: true
},
{
path: '/account/all-account/department',
name: '部門設(shè)置',
component: () => import('../components/view/account/department.vue'),
hidden: true
},
{
path: '/account/all-account/role',
name: '角色權(quán)限設(shè)置',
component: () => import('../components/view/account/role.vue'),
hidden: true
},
{
path: '/account/all-account/city',
name: '城市管理',
component: () => import('../components/view/account/city.vue'),
hidden: true
},
]
},
}
組件代碼:
index.vue
<template> <div class="page_container" style="overflow:auto;height:100%;background: #ffffff;padding: 10px;min-width:1200px;"> <router-view /> </div> </template>
account.vue
<template>
<!-- 賬號管理tab分頁 -->
<div id="employeeCareMng" class="page_container" style="overflow:auto;height:100%;background: #ffffff;min-width:1200px;">
<div v-if="isNative" >
<div style="height:100%;">
<el-tabs v-model="activeName" style="height:100%;" @tab-click="handleClick">
<el-tab-pane label="員工賬號" name="first" style="height:100%;">
<staff/>
</el-tab-pane>
<el-tab-pane label="代理人賬號" name="second" style="height:100%;">
<agent/>
</el-tab-pane>
<el-tab-pane label="部門設(shè)置" name="third" style="height:100%;">
<department/>
</el-tab-pane>
<el-tab-pane label="角色權(quán)限設(shè)置" name="fourth" style="height:100%;">
<role/>
</el-tab-pane>
<el-tab-pane label="城市管理" name="fifth" style="height:100%;">
<city/>
</el-tab-pane>
</el-tabs>
</div>
</div>
<div v-else style="height:100%;">
<router-view />
</div>
</div>
</template>
<script>
import staff from './staff'
import agent from './agent'
import department from './department'
import role from './role'
import city from './city'
export default {
components: {
staff,agent,department,role,city
},
data() {
return {
isNative: true,
activeName: 'first' //默認先渲染第一個
}
},
//頁面初始默認是第一個板塊展示
created() {
if (this.$route.path === '/account/all-account/staff') {
this.isNative = true
} else {
this.isNative = false
}
},
methods: {
handleClick(tab, event) {
console.log(tab, event)
}
}
}
</script>
<style scoped>
.page_container{
background: #ffffff;
height: 100%;
}
</style>
<style >
#employeeCareMng .el-tabs__content {
height:calc(100% - 55px);
}
</style>
其他tabs分頁的組件:
staff.vue 其他類似
<template>
<div class="staff">
員工賬號
</div>
</template>
<script>
export default {
name:"staff",
data(){
return {
}
},
created(){
},
methods: {
},
};
</script>
<style scoped>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Vue如何動態(tài)修改el-table的某列數(shù)據(jù)
這篇文章主要介紹了Vue如何動態(tài)修改el-table的某列數(shù)據(jù),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-04-04
vue3.0 vue.config.js 配置基礎(chǔ)的路徑問題
這篇文章主要介紹了vue3.0 vue.config.js 配置基礎(chǔ)的路徑問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-10-10
基于vue-cli3和element實現(xiàn)登陸頁面
這篇文章主要介紹了vue-cli3和element做一個簡單的登陸頁面本文實例圖文相結(jié)合給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2019-11-11
Element?plus中el-input框回車觸發(fā)頁面刷新問題以及解決辦法
在el-form表單組件中el-input組件輸入內(nèi)容后按下Enter鍵刷新了整個頁面,下面這篇文章主要給大家介紹了關(guān)于Element?plus中el-input框回車觸發(fā)頁面刷新問題以及解決辦法,需要的朋友可以參考下2024-03-03
Vite3結(jié)合Svelte3使用@import導(dǎo)入scss樣式
這篇文章主要為大家介紹了Vite3結(jié)合Svelte3使用@import導(dǎo)入scss樣式實現(xiàn)實例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-06-06
實用的 vue tags 創(chuàng)建緩存導(dǎo)航的過程實現(xiàn)
這篇文章主要介紹了實用的 vue tags 創(chuàng)建緩存導(dǎo)航的過程實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12

