exercises.md 494 字节
Newer Older
m0_65861709's avatar
update  
m0_65861709 已提交
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
# 问题描述

请在下列代码片中,找出globalData的错误使用方法?

## 答案

``` javascript
onLaunch() {
	getApp().globalData.username = 'csdn'
}
```

## 选项

### A

``` javascript
onLaunch() {
	this.globalData.username = 'csdn'
}
```

### B

``` javascript
onLoad() {
	getApp().globalData.username = 'csdn'
}
```

### C

``` javascript
onShow() {
	getApp().globalData.username = 'csdn'
}
```

### D

``` javascript
onHide() {
	getApp().globalData.username = 'csdn'
}
```