国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

vue同個(gè)按鈕控制展開(kāi)和折疊同個(gè)事件操作

瀏覽:60日期:2022-12-24 17:58:36

我就廢話不多說(shuō)了,大家還是直接看代碼吧~

<el-button :icon='!moreshow?’el-icon-arrow-down’:’el-icon-arrow-up’' @click='getmoreshow'>{{!moreshow?更多:隱藏}}</el-button>

data() { return { moreshow:false, count:1, }}

mounted() { this.getmoreshow()//避免點(diǎn)擊兩次才生效},methods: { getmoreshow(){ if(this.count%2==0){ this.moreshow=true }else{ this.moreshow=false } this.count++ },}

補(bǔ)充知識(shí):vue 可折疊面板的工作區(qū)組件

這個(gè)組件中使用了elementui的兩個(gè)圖標(biāo)

組件Js:

Vue.component(’work-container’, { props: [’height’], data: function () { return { isCollapse: false } }, computed: { topbarcssobj: function () { var obj = { padding: ’3px’ }; if (this.isCollapse) {obj.display = ’none’; } else {obj.display = ’block’;if (this.height) { obj.height = this.height + ’px’;} else { obj.height = ’40px’;} } return obj; }, btniconcssobj: function () { return this.isCollapse ? ’el-icon-caret-bottom’ : ’el-icon-caret-top’; }, strview: function () { return this.isCollapse ? ’顯示’ : ’隱藏’; } }, methods: { togglebar: function () { this.isCollapse = !this.isCollapse; } }, template: ’<el-container> <el-header v-bind:style='topbarcssobj'> <slot name='tbar'></slot> </el-header> <el-main> <div style='margin:3px;'> <div v-on:click='togglebar'> <i v-bind:class='btniconcssobj'>{{strview}}查詢條件</i> </div> <div> <slot name='btn'></slot> </div> </div> <div> <slot name='work'></slot> </div> </el-main> </el-container>’});

調(diào)用:

<script src='http://www.intensediesel.com/bcjs/~/Scripts/vue/workcontainer.js'></script> <work-container v-bind:height='80'> <template v-slot:tbar> <spec-combo v-on:selectspec='setSpec'></spec-combo> <ban-input v-on:selectban='setBan'></ban-input> <grade-input v-on:selectban='setGrade'></grade-input> </template> <template v-slot:work> {{spec}} {{ban}} {{grade}} </template> </work-container>

以上這篇vue同個(gè)按鈕控制展開(kāi)和折疊同個(gè)事件操作就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 化州市| 绍兴县| 星座| 右玉县| 诏安县| 白城市| 金平| 公安县| 东至县| 永兴县| 石狮市| 桂东县| 佛坪县| 安岳县| 云浮市| 泾川县| 筠连县| 咸阳市| 旬阳县| 隆回县| 开阳县| 莒南县| 历史| 穆棱市| 南木林县| 达孜县| 睢宁县| 永和县| 龙陵县| 开封市| 新建县| 张掖市| 尚义县| 闽侯县| 德化县| 新平| 吐鲁番市| 莫力| 井研县| 宁国市| 海口市|