progress.uvue 2.2 KB
Newer Older
Y
init  
yurj26 已提交
1 2 3 4 5
<template>
    <view>
        <page-head :title="title"></page-head>
        <view class="uni-padding-wrap uni-common-mt">
            <view class="progress-box">
Y
yurj26 已提交
6 7 8
                <progress :percent="pgList[0]" :active="true" :border-radius="borderRadius" :show-info="showInfo"
                    :font-size="fontSize" :stroke-width="strokeWidth" :background-color="backgroundColor"
                    class="progress p" @activeend="activeend" />
Y
init  
yurj26 已提交
9 10
            </view>
            <view class="progress-box">
Y
yurj26 已提交
11
                <progress :percent="pgList[1]" :stroke-width="3" class="progress p1" />
Y
init  
yurj26 已提交
12 13
            </view>
            <view class="progress-box">
Y
yurj26 已提交
14
                <progress :percent="pgList[2]" :stroke-width="3" class="progress p2" />
Y
init  
yurj26 已提交
15 16
            </view>
            <view class="progress-box">
Y
yurj26 已提交
17
                <progress :percent="pgList[3]" activeColor="#10AEFF" :stroke-width="3" class="progress p3" />
Y
init  
yurj26 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30
            </view>
            <view class="progress-control">
                <button type="primary" @click="setProgress" class="button">设置进度</button>
                <button type="warn" @click="clearProgress" class="button">清除进度</button>
            </view>
        </view>
    </view>
</template>
<script lang="ts">
    export default {
        data() {
            return {
                title: 'progress',
Y
yurj26 已提交
31 32 33 34 35 36 37 38
                pgList: [0, 0, 0, 0] as number[],

                curPercent: 0,
                showInfo: true,
                borderRadius: 0,
                fontSize: 16,
                strokeWidth: 3,
                backgroundColor: '#EBEBEB'
Y
init  
yurj26 已提交
39 40 41 42 43 44 45 46
            }
        },
        methods: {
            setProgress() {
                this.pgList = [20, 40, 60, 80] as number[]
            },
            clearProgress() {
                this.pgList = [0, 0, 0, 0] as number[]
Y
yurj26 已提交
47 48
            },
            activeend(e : ProgressActiveendEvent) {
Y
yurj26 已提交
49
                this.curPercent = e.detail.curPercent
Y
init  
yurj26 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
            }
        }
    }
</script>

<style>
    .progress-box {
        height: 50rpx;
        margin-bottom: 60rpx;
    }

    .progress-cancel {
        margin-left: 40rpx;
    }

    .button {
        margin-top: 20rpx;
    }
</style>