File tree Expand file tree Collapse file tree 1 file changed +4
-42
lines changed Expand file tree Collapse file tree 1 file changed +4
-42
lines changed Original file line number Diff line number Diff line change @@ -841,51 +841,13 @@ export default router
841
841
### 3.路由的query
842
842
843
843
``` html
844
- <template >
845
- <div >
846
- <ul class =" list" >
847
- <!-- to的对象写法 -->
848
- <li v-for =" item of data" :key =" item.id" >
849
- <router-link
850
- class =" link"
851
- :to =" {
852
- path:'/home/message/mes',
853
- query: { id:item.id, title:item.mes }
854
- }"
855
- >{{item.mes}}</router-link >
856
- </li >
857
- </ul >
858
- <hr >
859
- <router-view ></router-view >
860
- </div >
861
- </template >
862
-
863
- <script >
864
- export default {
865
- name: ' HomeChild1' ,
866
- data () {
867
- return {
868
- data: [
869
- {id: 1 ,mes: " 消息1" },
870
- {id: 2 ,mes: " 消息2" },
871
- {id: 3 ,mes: " 消息3" }
872
- ]
873
- }
874
- },
875
- }
844
+ <script setup >
845
+ import { useRoute } from ' vue-router' ;
846
+ const route = useRoute ();
876
847
</script >
877
-
878
- <style scoped >
879
- .list { margin-left :80px ; }
880
- .link {
881
- color : orange ;
882
- text-decoration : none ;
883
- background-color : skyblue ;
884
- }
885
- </style >
886
848
```
887
849
888
- > 接收参数 ` {{$ route.query.id}} `
850
+ > 接收参数 ` {{route.query.id}} `
889
851
890
852
#### 跳转路由并携带参数
891
853
You can’t perform that action at this time.
0 commit comments