[bugfix] Picker: render error when set data async (#3064)

This commit is contained in:
neverland 2019-03-28 20:23:22 +08:00 committed by GitHub
parent 28ca59827d
commit 2c4f32362d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,12 +57,7 @@ export default sfc({
onChange(columnIndex) {
if (this.simple) {
this.$emit(
'change',
this,
this.getColumnValue(0),
this.getColumnIndex(0)
);
this.$emit('change', this, this.getColumnValue(0), this.getColumnIndex(0));
} else {
this.$emit('change', this, this.getValues(), columnIndex);
}
@ -104,10 +99,7 @@ export default sfc({
// set options of column by index
setColumnValues(index, options) {
const column = this.children[index];
if (
column &&
JSON.stringify(column.options) !== JSON.stringify(options)
) {
if (column && JSON.stringify(column.options) !== JSON.stringify(options)) {
column.options = options;
column.setIndex(0);
}
@ -178,10 +170,12 @@ export default sfc({
return (
<div class={bem()}>
{Toolbar}
{this.loading && (
{this.loading ? (
<div class={bem('loading')}>
<Loading />
</div>
) : (
h()
)}
<div class={bem('columns')} style={columnsStyle} onTouchmove={prevent}>
{columns.map((item, index) => (
@ -197,10 +191,7 @@ export default sfc({
}}
/>
))}
<div
class={['van-hairline--top-bottom', bem('frame')]}
style={frameStyle}
/>
<div class={['van-hairline--top-bottom', bem('frame')]} style={frameStyle} />
</div>
</div>
);