zhangxiaoxu123456
2021-12-06 f32f7d699607bb159d25dcf441942370aba2c968
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
85
86
87
88
89
90
91
<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>
                <view class="u-no-demo-here">请点击弹出弹窗查看效果</view>
                <u-modal ref="uModal" v-model="show" :show-cancel-button="true" 
                    :show-title="showTitle" :async-close="asyncClose"
                    @confirm="confirm" :content="content"
                >
                    <!-- #ifndef MP-WEIXIN || MP-TOUTIAO -->
                    <view class="warp" style="margin: 30rpx;" v-if="contentSlot">
                        <image class="logo" src="https://uviewui.com/common/logo.png" style="width: 220rpx;" mode="widthFix"></image>
                    </view>
                    <!-- #endif -->
                </u-modal>
            </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 :current="current" :list="['显示', '隐藏']" @change="showChange"></u-subsection>
            </view>
            <view class="u-config-item">
                <view class="u-item-title">是否显示标题</view>
                <u-subsection current="0" :list="['是', '否']" @change="titleChange"></u-subsection>
            </view>
            <!-- #ifndef MP-WEIXIN -->
            <view class="u-config-item">
                <view class="u-item-title">自定义内容</view>
                <u-subsection current="1" :list="['是', '否']" @change="contentChange"></u-subsection>
            </view>
            <!-- #endif -->
            <view class="u-config-item">
                <view class="u-item-title">异步关闭</view>
                <u-subsection current="1" :list="['是', '否']" @change="asyncChange"></u-subsection>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                show: false,
                zoom: false,
                content: '慈母手中线,游子身上衣',
                contentSlot: false,
                showTitle: true,
                asyncClose: false,
            };
        },
        computed: {
            current() {
                return this.show ? 0 : 1;
            }
        },
        methods: {
            showChange(index) {
                this.show = !index;
            },
            titleChange(index) {
                this.showTitle = !index;
                this.show = true;
            },
            contentChange(index) {
                this.contentSlot = !index;
                this.show = true;
            },
            asyncChange(index) {
                this.show = true;
                this.asyncClose = !index;
            },
            confirm() {
                setTimeout(() => {
                    this.show = false;
                }, 2000)
            }
        }
    };
</script>
 
<style scoped lang="scss">
    .logo {
        height: auto;
        will-change: transform;
    }
</style>