[bugfix] Area: 修复省市区选择组件第一项无法选中

#721
This commit is contained in:
rex 2018-10-09 18:29:49 +08:00 committed by GitHub
parent bd4b73a12e
commit 69db8e9d19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3788 additions and 10 deletions

3780
example/pages/area/area.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
import Page from '../../common/page'; import Page from '../../common/page';
import AreaList from './area';
Page({ Page({
data: { data: {
@ -8,15 +9,12 @@ Page({
}, },
onShow() { onShow() {
wx.request({ setTimeout(() => {
url: 'https://cashier.youzan.com/pay/wsctrade/order/buy/getAllRegion.json', this.setData({
success: response => { loading: false,
this.setData({ areaList: AreaList
loading: false, });
areaList: response.data.data }, 1500);
});
}
});
}, },
onChange(event) { onChange(event) {

View File

@ -70,7 +70,7 @@ VantComponent({
const index = pickerValue.findIndex((item, index) => item !== value[index]); const index = pickerValue.findIndex((item, index) => item !== value[index]);
const values = displayColumns[index]; const values = displayColumns[index];
if (!value[index] || !values[value[index]]) { if (index < 0 || value[index] < 0 || !values[value[index]]) {
return; return;
} }