18034727885
2026-08-25 d081165686e520cc06cb87f928ed70d32401c138
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
    <view class="uni-container">
        <view class="uni-hello-text">
            <text class="hello-text">uni原生插件示例</text>
        </view>
        <view class="uni-panel" v-for="(item, index) in list" :key="item.id">
            <view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="triggerCollapse(index)">
                <text class="uni-panel-text">{{item.name}}</text>
                <text class="uni-panel-icon uni-icon" :class="item.open ? 'uni-panel-icon-on' : ''">{{item.pages ? '&#xe581;' : '&#xe470;'}}</text>
            </view>
            <view class="uni-panel-c" v-if="item.open">
                <view class="uni-navigate-item" v-for="(item2,key) in item.pages" :key="key" @click="goDetailPage(item2.url)">
                    <text class="uni-navigate-text">{{item2.name ? item2.name : item2}}</text>
                    <text class="uni-navigate-icon uni-icon">&#xe470;</text>
                </view>
            </view>
        </view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
                list: [{
                    id: 'ext-module',
                    name: '扩展 module',
                    open: false,
                    url: '/pages/sample/ext-module'
                },
                {
                    id: 'ext-component',
                    name: '扩展 component',
                    open: false,
                    url: '/pages/sample/ext-component'
                },
                {
                    id:'richAlert',
                    name:'插件示例RichAlert',
                    open:false,
                    url:'/pages/sample/richAlert'
                },
                {
                    id:'UTS_modules',
                    name:'UTS 原生插件',
                    open:false,
                    url:'/pages/sample/uts_toast'
                }],
                navigateFlag: false
            }
        },
        onLoad() {},
        methods: {
            triggerCollapse(e) {
                if (!this.list[e].pages) {
                    this.goDetailPage(this.list[e].url);
                    return;
                }
                for (var i = 0; i < this.list.length; ++i) {
                    if (e === i) {
                        this.list[i].open = !this.list[e].open;
                    } else {
                        this.list[i].open = false;
                    }
                }
            },
            goDetailPage(e) {
                if (this.navigateFlag) {
                    return;
                }
                this.navigateFlag = true;
                uni.navigateTo({
                    url: e
                });
                setTimeout(() => {
                    this.navigateFlag = false;
                }, 200)
                return false;
            }
        }
    }
</script>
 
<style>
</style>