mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Picker: render error when set data async (#3064)
This commit is contained in:
parent
28ca59827d
commit
2c4f32362d
@ -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>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user