exercises.md 1.5 KB
Newer Older
m0_65861709's avatar
update  
m0_65861709 已提交
1 2
# condition启动模式配置

m0_65861709's avatar
update  
m0_65861709 已提交
3 4 5 6 7 8
假设小程序中有如下几个页面路由:
pages/home/index
pages/news/list
pages/news/detail?id=
pages/uc/index
当我需要将启动页面设置为pages/news/detail,下列关于condition配置写法,正确的是?
m0_65861709's avatar
update  
m0_65861709 已提交
9 10 11

## 答案

m0_65861709's avatar
update  
m0_65861709 已提交
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
```json
"condition": {
	"current": 2,
	"list": [{
			"name": "home",
			"path": "pages/home/index"
		},
		{
			"name": "newsList",
			"path": "pages/news/index"
		},
		{
			"name": "newsDetail",
			"path": "pages/news/detail",
			"query": "id=1"
		},
		{
			"name": "uc",
			"path": "pages/uc/index"
		}
	]
}
```
m0_65861709's avatar
update  
m0_65861709 已提交
35 36 37 38 39

## 选项

### A

m0_65861709's avatar
update  
m0_65861709 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
```json
"condition": {
	"list": [{
			"name": "home",
			"path": "pages/home/index"
		},
		{
			"name": "newsList",
			"path": "pages/news/index"
		},
		{
			"name": "newsDetail",
			"path": "pages/news/detail",
			"query": "id=1"
		},
		{
			"name": "uc",
			"path": "pages/uc/index"
		}
	]
}
```
m0_65861709's avatar
update  
m0_65861709 已提交
62 63 64

### B

m0_65861709's avatar
update  
m0_65861709 已提交
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
```json
"condition": {
	"list": [{
			"name": "home",
			"path": "pages/home/index"
		},
		{
			"name": "newsList",
			"path": "pages/news/index"
		},
		{
			"name": "newsDetail",
			"path": "pages/news/detail?id=1"
		},
		{
			"name": "uc",
			"path": "pages/uc/index"
		}
	]
}
```
m0_65861709's avatar
update  
m0_65861709 已提交
86 87 88

### C

m0_65861709's avatar
update  
m0_65861709 已提交
89 90 91 92 93 94 95 96 97 98
```json
"condition": {
	"list": [
		{
			"name": "newsDetail",
			"path": "pages/news/detail?id=1"
		}
	]
}
```
m0_65861709's avatar
update  
m0_65861709 已提交
99 100 101

### D

m0_65861709's avatar
update  
m0_65861709 已提交
102 103 104 105 106 107 108 109 110 111 112 113 114 115
```json
"condition": {
	"list": [{
			"name": "home",
			"path": "pages/home/index"
		},
		{
			"name": "newsDetail",
			"path": "pages/news/detail?id=1"
		}
	]
}
```

m0_65861709's avatar
update  
m0_65861709 已提交
116 117