select-country.js
801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// login/select-country/select-country.js
import { getCountryArea, getGlobalData } from '../../libs/login/login.js';
import Yas from '../../utils/yas';
let yas;
Page({
/**
* 页面的初始数据
*/
data: {
country: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
yas = new Yas(this);
yas.pageOpenReport();
this.getCountryArea();
},
onShow: function () {
},
async getCountryArea() {
try {
let country = await getCountryArea();
this.setData({
country
})
} catch (error) {
}
},
selectCountry(e) {
let country = e.currentTarget.dataset.country;
let globalData = getGlobalData();
globalData.country = country;
wx.navigateBack({
delta: 1
});
},
})