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