| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <template>
- <view class="leftMenuRoot df fdr" v-show="isShow">
- <!-- 左边导航栏 -->
- <view class="leftBox">
- <view class="leftMenu-topIcon df aic" @click="hide">
- <img src="../assets/leftMenu/icon_leftUp.png"></img>
- </view>
- <view class="df fdc" v-for="(menu1,i) in btnList" :key="i" @click="onLeftBtn1Click(i)">
- <view class="leftMenu-btn1 df fdr aic">
- <view class="leftMenu-btn1-icon df ">
- <img :src="checkedIndex1==i?menu1.icon_btn1_checked:menu1.icon_btn1_unchecked"></img>
- </view>
- <view class="leftMenu-btn1-text" :style="{color:checkedIndex1==i?color_checked:color_unchecked}">{{menu1.text}}</view>
- </view>
- <view class="leftMenu-line"></view>
- <view class="leftMenu-btn2-box1 df fdc" v-show="checkedIndex1==i" v-for="(menu2,m) in menu1.list" :key="m" @click="onLeftBtn2Click(m)">
- <view class="leftMenu-btn2-box2 df fdr aic">
- <view class="leftMenu-btn2-icon df">
- <img :src="checkedIndex2==m?icon_btn2_checked:icon_btn2_unchecked"></img>
- </view>
- <view class="leftMenu-btn2-text" :style="{color:checkedIndex2==m?color_checked:color_unchecked}">{{menu2}}</view>
- </view>
- </view>
- </view>
- </view>
- <!-- 右边半透明 -->
- <view class="rightBox" @click="hide"></view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- isShow: false,
- checkedIndex1: 3,
- checkedIndex2: 0,
- // ------以下为静态
- btnList: [
- {
- "text": '后台',
- "icon_btn1_checked": require('../assets/leftMenu/icon_ksxx_02.png'),
- "icon_btn1_unchecked": require('../assets/leftMenu/icon_ksxx_01.png'),
- "list": []
- }
- ],
- icon_btn2_checked: require('../assets/leftMenu/icon_btn2_02.png'),
- icon_btn2_unchecked: require('../assets/leftMenu/icon_btn2_01.png'),
- color_checked: '#EA252C',
- color_unchecked: '#020202'
- }
- },
- methods: {
- initData() {
- this.checkedIndex1 = -1;
- this.checkedIndex2 = -1;
- },
- hide() {
- this.isShow = false;
- },
- show(indexArr) {
- this.isShow = true;
- console.log("左侧导航展示",indexArr);
- this.checkedIndex1 = indexArr[0];
- this.checkedIndex2 = indexArr[1];
- },
- onLeftBtn1Click(index) {
- this.checkedIndex2 = -1;
- if (this.btnList[index].list.length > 0) {
- // 收起
- if (index == this.checkedIndex1) {
- this.checkedIndex1 = -1;
- }
- // 展开
- else {
- this.checkedIndex1 = index;
- }
- } else {
- this.hide();
- this.$emit("onLeftMenuClick", [index,-1])
- }
- },
- onLeftBtn2Click(index) {
- this.checkedIndex2 = index;
- this.hide();
- this.$emit("onLeftMenuClick", [this.checkedIndex1,index])
- }
- }
- }
- </script>
- <style lang="scss">
- .leftMenuRoot {
- position: fixed;
- width: 100%;
- height: 100%;
- }
- .leftBox {
- width: px2vw(226);
- background: #FFFFFF;
- }
- .rightBox {
- flex: 1;
- background: #000000;
- opacity: 0.24;
- }
- .leftMenu-topIcon {
- background: #EA252C;
- height: 6.2vw;
- }
- .leftMenu-topIcon img {
- margin-left: px2vw(41);
- }
- .leftMenu-btn1-icon {
- margin-left: px2vw(21);
- margin-top: px2vw(32);
- margin-bottom: px2vw(32);
- }
- .leftMenu-btn1-text {
- margin-left: px2vw(14);
- font-size: px2vw(22);
- }
- .leftMenu-line {
- height: 2px;
- background: #F2F2F2;
- }
- .leftMenu-btn2-box1 {
- background: #F2F2F2;
- }
- .leftMenu-btn2-box2 {
- margin-left: px2vw(48);
- margin-right: px2vw(45);
- margin-top: px2vw(25);
- margin-bottom: px2vw(25);
- }
- .leftMenu-btn2-text {
- margin-left: px2vw(14);
- font-size: px2vw(20);
- }
- </style>
|