这篇文章主要介绍本文来源gao($daima.com搞@代@#码(网5了vue同个按钮控制展开和折叠同个事件操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
我就废话不多说了,大家还是直接看代码吧~
{{!moreshow?更多前端的相关知识:vue 可折叠面板的工作区组件
这个组件中使用了elementui的两个图标
组件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: '\ \ \ \ \ <div style="margin:3px">\ <div style="float:left;margin-right:10px;cursor:pointer;color: #d3dce6">\ <i>{{strview}}查询条件</i>\ </div>\ <div>\ \ </div>\ </div>\ <div>\ \ </div>\ \ ' });调用:
{{spec}} {{ban}} {{grade}}
以上就是vue同个按钮控制展开和折叠同个事件操作的详细内容,更多请关注gaodaima搞代码网其它相关文章!