text.uvue 2.8 KB
Newer Older
Y
init  
yurj26 已提交
1 2 3 4 5 6 7 8 9
<template>
    <view>
        <page-head :title="title"></page-head>
        <view class="uni-padding-wrap uni-common-mt">
            <view class="text-box" scroll-y="true">
                <text class="text">{{text}}</text>
            </view>
            <view class="uni-btn-v">
                <button class="uni-btn" type="primary" :disabled="!canAdd" @click="add">add line</button>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
10 11
                <button class="uni-btn" type="warn" :disabled="!canRemove" @click="remove">remove line</button>
				<button class="uni-btn" type="primary" @click="textProps">更多属性示例</button>
Y
init  
yurj26 已提交
12 13 14 15
            </view>
        </view>
    </view>
</template>
Y
yurj26 已提交
16
<script lang="uts">
Y
init  
yurj26 已提交
17 18 19 20 21 22
    export default {
        data() {
            return {
                title: 'text',
                texts: [
                    'HBuilderX,轻巧、极速,极客编辑器',
W
wanganxp 已提交
23 24 25 26 27 28 29 30 31 32 33
                    'uni-app x,终极跨平台方案',
                    'uniCloud,js serverless云服务',
					'uts,大一统语言',
					'uniMPSdk,让你的App具备小程序能力',
					'uni-admin,开源、现成的全端管理后台',
					'uni-id,开源、全端的账户中心',
					'uni-pay,开源、云端一体、全平台的支付',
					'uni-ai,聚合ai能力',
					'uni-cms,开源、云端一体、全平台的内容管理平台',
					'uni-im,开源、云端一体、全平台的im即时消息',
					'uni统计,开源、完善、全平台的统计报表',
Y
init  
yurj26 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
                    '......'
                ] as string[],
                text: '',
                canAdd: true,
                canRemove: false,
                extraLine: [] as string[]
            }
        },
        methods: {
            add: function () {
                this.extraLine.push(this.texts[this.extraLine.length % 12]);
                this.text = this.extraLine.join('\n');
                this.canAdd = this.extraLine.length < 12;
                this.canRemove = this.extraLine.length > 0;
            },
            remove: function () {
                if (this.extraLine.length > 0) {
                    this.extraLine.pop();
                    this.text = this.extraLine.join('\n');
                    this.canAdd = this.extraLine.length < 12;
                    this.canRemove = this.extraLine.length > 0;
                }
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
56 57 58 59 60 61
            },
			textProps: function () {
			    uni.navigateTo({
			    	url: '/pages/component/text/text-props'
			    })
			}
Y
init  
yurj26 已提交
62 63 64 65 66 67 68 69 70
        }
    }
</script>

<style>
    .text-box {
        margin-bottom: 40rpx;
        padding: 40rpx 0;
        display: flex;
Y
yurj26 已提交
71
        min-height: 300rpx;
Y
init  
yurj26 已提交
72 73 74 75 76 77 78 79
        background-color: #FFFFFF;
        justify-content: center;
        align-items: center;
    }

    .text {
        font-size: 30rpx;
        color: #353535;
Y
yurj26 已提交
80 81
        line-height: 54rpx;
        text-align: center;
Y
init  
yurj26 已提交
82 83
    }
</style>