@kaiyinchem/ky-uniui 1.0.12 → 1.0.13

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.
@@ -43,7 +43,7 @@
43
43
 
44
44
  <script>
45
45
  export default {
46
- emits: ['select', 'search'],
46
+ emits: ['select', 'search', 'update:keyword', 'update:visible'],
47
47
  props: {
48
48
  keyword: {
49
49
  type: String,
@@ -96,9 +96,11 @@
96
96
  methods: {
97
97
  show() {
98
98
  this.state = true
99
+ this.$emit('update:visible', true)
99
100
  },
100
101
  hide() {
101
102
  this.state = false
103
+ this.$emit('update:visible', false)
102
104
  },
103
105
  save() {
104
106
  const hasSame = this.historyList.some(e => e === this.str)
@@ -106,12 +108,12 @@
106
108
  this.historyList.push(this.str)
107
109
  this.$db.set(this.keyStr, this.historyList)
108
110
  }
109
- this.state = false
111
+ this.hide()
110
112
  uni.hideKeyboard()
111
113
  },
112
114
  handleClear() {
113
115
  this.str = undefined
114
- this.state = false
116
+ this.hide()
115
117
  },
116
118
  handleSearch() {
117
119
  this.$emit('search', this.str)
@@ -121,7 +123,7 @@
121
123
  },
122
124
  handleFocus() {
123
125
  if (!this.str) {
124
- this.state = true
126
+ this.show()
125
127
  }
126
128
  },
127
129
  selectKeyword(str) {
@@ -131,6 +133,9 @@
131
133
  clearSignle(index) {
132
134
  this.historyList.splice(index, 1)
133
135
  this.$db.set(this.keyStr, this.historyList)
136
+ if (!this.historyList.length) {
137
+ this.hide()
138
+ }
134
139
  },
135
140
  clearHistory() {
136
141
  this.$confirm({ content: '确定清除全部历史吗?' }, (res) => {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "style"
8
8
  ],
9
9
  "description": "an uniapp ui",
10
- "version": "1.0.12",
10
+ "version": "1.0.13",
11
11
  "repository": {
12
12
  "type": "git",
13
13
  "url": "git+https://github.com/yezipi/ky-uniui.git"