Skip to content

Commit

Permalink
feat: pi-select选项增加disabled属性
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhenfei committed Nov 14, 2020
1 parent 704fb77 commit fc0ea1a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/pi-select/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
:id="`id-${item[keyField]}`"
:key="item[keyField]"
:style="[itemStyle, getItemStyle]"
:class="{ 'pi-solid-bottom-1': showItemBottomBorder }"
class="pi-justify-between pi-align-center pi-fz-30 pi-pd-lr-32"
:class="{ 'pi-solid-bottom-1': showItemBottomBorder, 'disabled': item.disabled }"
class="select-item pi-justify-between pi-align-center pi-fz-30 pi-pd-lr-32"
@tap.stop="handleSelectItem(item)"
>
<slot name="item" :item="item">
Expand Down Expand Up @@ -112,6 +112,7 @@ export default {
// 选项列表,默认([])
items: {
type: Array,
// [ { id: 'partyMember', text: '党员', disabled: true }]
default() {
return select.items
}
Expand Down Expand Up @@ -327,6 +328,7 @@ export default {
this.handleEmitChange()
},
handleSelectItem(item) {
if (item.disabled) return
if (!this.isMulti) {
// 单选
if (!this.singleCancel) {
Expand Down Expand Up @@ -361,5 +363,8 @@ export default {
<style lang="scss" scoped>
.pi-select {
height: 50vh;
.select-item.disabled {
opacity: 0.4;
}
}
</style>

0 comments on commit fc0ea1a

Please sign in to comment.