zhangxiaoxu123456
2021-12-17 4d4a844ef624dde8667b314d353599297f6cb8d9
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
<template>
    <view class="u-demo">
        <view class="u-demo-wrap">
            <view class="u-demo-title">演示效果</view>
            <view class="u-demo-area">
                <u-toast ref="uToast"></u-toast>
                <u-button @click="showAction">唤起ActionSheet</u-button>
                <u-action-sheet :cancel-btn="cancel" :mask-close-able="maskClick" :tips="tips" 
                @click="click" :list="list" v-model="show" :safe-area-inset-bottom="true"></u-action-sheet>
            </view> 
        </view>
        <view class="u-config-wrap">
            <view class="u-config-title u-border-bottom">
                参数配置
            </view>
            <view class="u-config-item">
                <view class="u-item-title">取消按钮</view>
                <u-subsection :list="['是', '否']" @change="cancelChange"></u-subsection>
            </view>
            <view class="u-config-item">
                <view class="u-item-title">点击遮罩关闭</view>
                <u-subsection :list="['是', '否']" @change="maskClickChange"></u-subsection>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                list: [{
                    text: '最是人间留不住',
                }, {
                    text: '朱颜辞镜花辞树',
                    disabled: true
                }, {
                    text: '正是江南好风景',
                    subText: '春江水暖鸭先知'
                }, {
                    text: '落花时节又逢君'
                }],
                tips: {
                    text: ''
                },
                show: false,
                cancel: true,
                maskClick: true
            }
        },
        methods: {
            showAction() {
                this.show = true;
            },
            click(index) {
                this.$refs.uToast.show({
                    type: 'success',
                    title: '点击了第' + (index + 1) + '项'
                })
            },
            tipsChange(index) {
                if(index == 0) this.show = true;
                this.tips.text = index == 0 ? '请谨慎执行您的操作' : ''
            },
            cancelChange(index) {
                this.show = true;
                this.cancel = index == 0 ? true : false
            },
            maskClickChange(index) {
                if(index == 1) this.cancel = true;
                this.show = true;
                this.maskClick = index == 0 ? true : false
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .wrap {
        padding: 24rpx;
    }
</style>