vue中框架下elmentui的(el

编程入门 行业动态 更新时间:2024-10-28 06:21:32

vue中<a href=https://www.elefans.com/category/jswz/34/1770644.html style=框架下elmentui的(el"/>

vue中框架下elmentui的(el

 根据原型体,选一个最接近的UI组件 el-tabs

 html:

思路:通过el-tabs默认选中页签(v-model的值)与(切换列表循环的下标)进行判断,为true 表示当前选中项,就添加选中的图片,为false 添加默认的图片

 <template><div><div class="know_content"><el-tabs :tab-position="tabPosition" v-model="activeId"><el-tab-pane label="用户管理" v-for="(s,sIndex) in subjectList" :key="sIndex" :name="sIndex+''"><!-- 左边 “标题” 切换 --><template slot="label"><div class="know_item"><img :src="activeId==sIndex?s.active:s.img" alt=""><div>{{s.title}}</div></div></template><!-- 右边pane内容 --><div class="know_right"></div></el-tab-pane></el-tabs></div></div>
</template>

js:


<script>
export default {data () {return {tabPosition: 'left',activeId: '0', // 默认显示第一页subjectList: [{title: '数学', active: require('@/assets/home/math1.png'), img: require('@/assets/home/math.png')},{title: '物理', active: require('@/assets/home/physics1.png'), img: require('@/assets/home/physics.png')},{title: '英语', active: require('@/assets/home/english1.png'), img: require('@/assets/home/english.png')}]}}
}
</script>

 css:

<style lang="scss" scoped>// 内容/deep/ .know_content{padding:22px 20px 18px 20px;margin:0px 80px;height: calc(100vh - 13vw);background: url('../../assets/home/know_bgs.png') no-repeat;background-size: 100% 100%;display: flex;justify-content: space-between;.el-tabs__header.is-left{margin-right: 0;}.el-tabs__nav-wrap::after {display: none;}.el-tabs__active-bar {display: none;}.el-tabs__nav-scroll::-webkit-scrollbar {height: 0;}.el-tabs__nav-scroll {overflow-x: scroll;background: linear-gradient(50deg, transparent 38px, rgba(25, 177, 201,.2) 0);padding-right: 40px;width: 220px;height: 100%;}.el-tabs__item {font-size: 24px;color: #D6D6D6;padding: 22px 0;border-radius: 0px 64px 65px 0px;height: auto;text-align: center;width: 180px;margin: 60px 0;}.el-tabs__item.is-active {color: #fff;background: #03ba82;}.el-tabs__content {z-index: 10;text-align: left;color: #fff;}.know_item{img{height: 48px;}}.know_right{width:1435px;}}
}
</style>

       希望我的愚见能够帮助你哦~,若有不足之处,还望指出,你们有更好的解决方法,欢迎大家在评论区下方留言支持,大家一起相互学习参考呀~

更多推荐

vue中框架下elmentui的(el

本文发布于:2024-03-09 01:26:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1723223.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框架   vue   el   elmentui

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!