I won't say much nonsense, let's just read the code~
<el-button :icon="!moreshow?'el-icon-arrow-down':'el-icon-arrow-up'" @click="getmoreshow">{{!moreshow?More:Hide}}</el-button>
data() { return { moreshow:false, count:1, } }
mounted() { ()//Avoid clicking twice before it takes effect}, methods: { getmoreshow(){ if(%2==0){ =true }else{ =false } ++ }, }
Supplementary knowledge:vue workspace components for foldable panels
Two icons of elementui are used in this component
Component Js:
('work-container', { props: ['height'], data: function () { return { isCollapse: false } }, computed: { topbarcssobj: function () { var obj = { padding: '3px' }; if () { = 'none'; } else { = 'block'; if () { = + 'px'; } else { = '40px'; } } return obj; }, btniconcssobj: function () { return ? 'el-icon-caret-bottom' : 'el-icon-caret-top'; }, strview: function () { return ? 'show' : 'hide'; } }, methods: { togglebar: function () { = !; } }, template: '<el-container>\ <el-header v-bind:style="topbarcssobj">\ <slot name="tbar"></slot>\ </el-header>\ <el-main>\ <div style="margin:3px;">\ <div style="float:left;margin-right:10px;cursor:pointer;color: #d3dce6;display:none;" v-on:click="togglebar">\ <i v-bind:class="btniconcssobj">{{strview}}Query criteria</i>\ </div>\ <div>\ <slot name="btn"></slot>\ </div>\ </div>\ <div>\ <slot name="work"></slot>\ </div>\ </el-main>\ </el-container>' });
Called:
<script src="~/Scripts/vue/"></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>
The above article on the Vue button controls the same event operation of the same button are all the content I share with you. I hope you can give you a reference and I hope you can support me more.