File tree 2 files changed +40
-2
lines changed
2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 2
2
<div >
3
3
<Card >
4
4
<h2 >ID: {{ $route.params.id }}</h2 >
5
+ <Button @click =" close" >调用closeTag方法关闭本页</Button >
5
6
</Card >
6
7
</div >
7
8
</template >
8
9
9
10
<script >
11
+ import { mapMutations } from ' vuex'
10
12
export default {
11
- name: ' argu_page'
13
+ name: ' params' ,
14
+ methods: {
15
+ ... mapMutations ([
16
+ ' closeTag'
17
+ ]),
18
+ close () {
19
+ /**
20
+ * 如果是调用closeTag方法,普通的页面传入的对象参数只需要写name字段即可
21
+ * 如果是动态路由和带参路由,需要传入query或params字段,用来区别关闭的是参数为多少的页面
22
+ */
23
+ this .closeTag ({
24
+ name: ' params' ,
25
+ params: {
26
+ id: this .$route .params .id
27
+ }
28
+ })
29
+ }
30
+ }
12
31
}
13
32
</script >
14
33
Original file line number Diff line number Diff line change 2
2
<div >
3
3
<Card >
4
4
<h2 >ID: {{ $route.query.id }}</h2 >
5
+ <Button @click =" close" >调用closeTag方法关闭本页</Button >
5
6
</Card >
6
7
</div >
7
8
</template >
8
9
9
10
<script >
11
+ import { mapMutations } from ' vuex'
10
12
export default {
11
- name: ' query'
13
+ name: ' query' ,
14
+ methods: {
15
+ ... mapMutations ([
16
+ ' closeTag'
17
+ ]),
18
+ close () {
19
+ /**
20
+ * 如果是调用closeTag方法,普通的页面传入的对象参数只需要写name字段即可
21
+ * 如果是动态路由和带参路由,需要传入query或params字段,用来区别关闭的是参数为多少的页面
22
+ */
23
+ this .closeTag ({
24
+ name: ' query' ,
25
+ query: {
26
+ id: this .$route .query .id
27
+ }
28
+ })
29
+ }
30
+ }
12
31
}
13
32
</script >
14
33
You can’t perform that action at this time.
0 commit comments