Skip to content

Commit ae45b45

Browse files
committed
[2.6.1] Check <Autocomplete /> initial value
1 parent 386a627 commit ae45b45

File tree

6 files changed

+25
-12
lines changed

6 files changed

+25
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.6.1
2+
3+
- Check `<Autocomplete />` initial value. If it's string — use it. If there is a default value for this control — use it.
4+
15
## 2.6.0
26

37
- Added `<Autocomplete />` control

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ See demo at [https://detools.github.io/vue-form](https://detools.github.io/vue-f
7979

8080
## Changelog
8181

82+
- [2.6.1](/CHANGELOG.md#261)
8283
- [2.6.0](/CHANGELOG.md#260)
8384
- [2.5.11](/CHANGELOG.md#2511)
8485
- [2.5.10](/CHANGELOG.md#2510)

VueForm/components/ConnectedAutocomplete.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Autocomplete } from 'element-ui'
22
import noop from 'lodash/noop'
33
import isNull from 'lodash/isNull'
4+
import isString from 'lodash/isString'
45
import ConnectedControlMixin from '../mixins/ConnectedControl'
56

67
const ConnectedAutocomplete = {
@@ -10,10 +11,7 @@ const ConnectedAutocomplete = {
1011
required: true,
1112
},
1213

13-
value: {
14-
type: [String, Number],
15-
default: '',
16-
},
14+
value: String,
1715

1816
labelKey: {
1917
type: String,
@@ -96,13 +94,23 @@ const ConnectedAutocomplete = {
9694
setValue(nextValue)
9795
},
9896

99-
renderComponent() {
97+
renderComponent(value) {
98+
let inputValue
99+
100+
if (isString(value)) {
101+
inputValue = value
102+
}
103+
104+
if (isString(this.viewValue)) {
105+
inputValue = this.viewValue
106+
}
107+
100108
return (
101109
<Autocomplete
102110
class={this.class}
103111
name={this.name}
104112
type={this.type}
105-
value={this.viewValue}
113+
value={inputValue}
106114
placeholder={this.placeholder}
107115
clearable={this.clearable}
108116
disabled={this.disabled}

docs/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/vendors~main.bundle.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@detools/vue-form",
3-
"version": "2.6.0",
3+
"version": "2.6.1",
44
"description": "Form State Management for VueJS",
55
"main": "VueForm/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)