#vue循环路由

 1 <template>
 2     <view class="content">
 3         <view v-for="(item, index) in list" 
 4               :key="index"
 5               class="cell-item"
 6               @click="showDetail(item)"
 7         >{{item.name}}</view>
 8     </view>
 9 </template>
10 
11 <script>
12     export default {
13         data() {
14             return {
15                 list: [
16                     {
17                         name: '页面1',
18                         value: 'html1'
19                     },
20                     {
21                         name: '页面2',
22                         value: 'html2'
23                     },
24                     {
25                         name: '页面3',
26                         value: 'html3'
27                     }
28                 ]
29             }
30         },
31         onLoad() {
32             console.log(111);
33         },
34         methods: {
35             showDetail(item) {
36                 uni.navigateTo({
37                     url: `/pages/examples/${item.value}/${item.value}`
38                 })
39             }
40         }
41     }
42 </script>
43 
44 <style lang="scss">
45     .content {
46         .cell-item {
47             padding: 30rpx;
48             margin: 20rpx;
49             box-shadow: 0 1px 5px #ebedf0;
50             background: #fff;
51         }
52     }
53 </style>
View Code

 

posted @ 2021-10-28 12:29  ~落辰~  阅读(20)  评论(0)    收藏  举报