@kyfe/hroa-ui 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kyfe/hroa-ui",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -79,9 +79,9 @@
79
79
  },
80
80
  },
81
81
  watch: {
82
- concatList: {
83
- handler (list) {
84
- this.initListActive(list)
82
+ checkList: {
83
+ handler () {
84
+ this.initListActive()
85
85
  },
86
86
  immediate: true
87
87
  }
@@ -95,7 +95,8 @@
95
95
  },
96
96
  initState () {
97
97
  },
98
- initListActive (list) {
98
+ initListActive () {
99
+ const list = this.concatList
99
100
  if (!Array.isArray(list)) return
100
101
 
101
102
  // 设置默认值
@@ -105,19 +106,24 @@
105
106
  this.isShowAll && this.checkList.length === 0 && (this.listActive[0] = true) // 当有全部选项时,全部选中
106
107
  },
107
108
  select (index) {
109
+ console.log(index, 'index')
108
110
  const active = this.listActive[index]
109
111
  this.listActive.splice(index, 1, !active)
110
112
 
111
- if (!this.isShowAll) return
112
- if (index === 0) {
113
- this.listActive = this.listActive.map(() => false)
114
- this.listActive.splice(index, 1, true)
115
- } else {
116
- this.listActive.splice(0, 1, this.listActive.every((item) => !item))
113
+ if (this.isShowAll) {
114
+ if (index === 0) {
115
+ this.listActive = this.listActive.map(() => false)
116
+ this.listActive.splice(index, 1, true)
117
+ } else {
118
+ this.listActive.splice(0, 1, this.listActive.every((item) => !item))
119
+ }
117
120
  }
118
121
  const chooseList = this.concatList.filter((item, index) => this.listActive[index])
119
122
  this.$emit('select', chooseList)
120
123
  }
124
+ },
125
+ cleanListActive () {
126
+
121
127
  },
122
128
  render () {
123
129
  const width = this.selfAdaption ? null : `calc((100% - ${this.margin * (this.divideeQually - 1)}px) / ${this.divideeQually})`
@@ -43,15 +43,41 @@
43
43
  getContainer: {
44
44
  type: String,
45
45
  default: 'body'
46
+ },
47
+ closeable: {
48
+ type: Boolean
49
+ },
50
+ // 弹出位置,可选值为 top bottom right left
51
+ position: {
52
+ type: String,
53
+ default: 'bottom'
54
+ },
55
+ // 展示确认按钮
56
+ showSubmitBtn: {
57
+ type: Boolean,
58
+ default: true
46
59
  }
47
60
  },
48
61
  data () {
49
62
  return {
50
63
  isShowPopup: false,
51
- selectValue: []
64
+ selectValue: [],
65
+ popupStyle: ''
52
66
  }
53
67
  },
54
68
  watch: {
69
+ position: {
70
+ handler (val) {
71
+ const positionCls = {
72
+ top: 'border-radius: 0 0 10px 10px',
73
+ bottom: 'border-radius: 10px 10px 0 0',
74
+ left: 'border-radius: 0 10px 10px 0',
75
+ right: 'border-radius: 10px 0 0 10px '
76
+ }
77
+ this.popupStyle = positionCls[val] || 'border-radius: 0'
78
+ },
79
+ immediate: true
80
+ },
55
81
  show: {
56
82
  handler (val) {
57
83
  this.isShowPopup = val
@@ -66,9 +92,10 @@
66
92
  return (
67
93
  // get-container挂载在body的原因:防止被外部组件内容遮挡
68
94
  <HrPopup show={this.isShowPopup}
69
- closeable
70
95
  get-container={this.getContainer}
71
- position="bottom"
96
+ closeable={this.closeable}
97
+ position={this.position}
98
+ popupStyle={this.popupStyle}
72
99
  safe-area-inset-bottom
73
100
  title={this.title}
74
101
  onClose={this.close}>
@@ -86,7 +113,7 @@
86
113
  })
87
114
  }
88
115
  </div>
89
- <div class="submit-btn" onClick={this.submit}>确认</div>
116
+ {this.showSubmitBtn && <div class="submit-btn" onClick={this.submit}>确认</div>}
90
117
  </div>
91
118
  </HrPopup>
92
119
  )
@@ -118,8 +145,9 @@
118
145
  }
119
146
  },
120
147
  close () {
148
+ const selectOptions = this.columns.filter(i => this.selectValue.includes(i[this.valKey]))
121
149
  this.isShowPopup = false
122
- this.$emit('close')
150
+ this.$emit('close', this.selectValue, selectOptions)
123
151
  },
124
152
  submit () {
125
153
  const selectOptions = this.columns.filter(i => this.selectValue.includes(i[this.valKey]))
@@ -132,7 +160,7 @@
132
160
 
133
161
  <style lang="less" scoped>
134
162
  .hr-select-list {
135
- min-height: 30vh;
163
+ // min-height: 30vh;
136
164
  max-height: 70vh;
137
165
  display: flex;
138
166
  flex-direction: column;