zhangxiaoxu123456
2021-12-20 301289e539c417995f95f5cb91fd1f6043bb7cfd
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
<template>
    <view class="u-demo">
        <view class="u-demo-wrap">
            <view class="u-demo-title">演示效果</view>
            <view class="u-demo-area">
                <view class="u-no-demo-here" style="text-align: left;">
                    此处演示为通过JS调用框架内置颜色值,此外还可以通过scss变量调用。
                </view>
                <view class="u-demo-result-line" :style="{color: color, backgroundColor: '#ffffff'}">
                    晓镜但愁云鬓改,夜吟应觉月光寒
                </view>
            </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="['primary', 'success', 'error', 'warning', 'info']" @change="modeChange"></u-subsection>
            </view>
            <view class="u-config-item">
                <view class="u-item-title">常用颜色</view>
                <u-subsection :list="['主要文字', '常规文字', '次要文字', '占位文字', '边框颜色']" @change="colorChange"></u-subsection>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                color: this.$u.color['primary'],
            }
        },
        methods: {
            modeChange(index) {
                let colorName = index == 0 ? 'primary' : index == 1 ? 'success' : index == 2 ? 'error' : index == 3 ? 'warning'  : 'info';
                this.color = this.$u.color[colorName];
            },
            colorChange(index) {
                this.color = index == 0 ? '#303133' : index == 1 ? '#606266' : index == 2 ? '#909399' : index == 3 ? '#c0c4cc' : '#e4e7ed';
            },
            getResult() {
                this.result = this.$u.trim(this.string, this.pos);
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .u-demo {}
</style>