uni-app 常用基本组件使用

一 text组件

1 代码

<template>
    <view>
        <view>
            <text>唱歌跳舞打篮球</text>
        </view>
        <view>
            <text selectable>唱歌跳舞打篮球</text>
        </view>
        <view>
            <text selectable space="ensp">唱歌    跳舞打篮球</text>
        </view>
        <view>
            <text selectable space="emsp">唱歌    跳舞打篮球</text>
        </view>
        <view>
            <text selectable space="nbsp" style="font-size: 40px;">唱歌    跳舞打篮球</text>
        </view>
        <view>&amp;</view>
    </view>
</template>
<script>
</script>
<style>
</style>

2 效果

二 view组件

1 代码

<template>
    <view class="box2" hover-class="box-active2">
        <!-- hover-class:按下去的样式 -->
        <!-- hover-stop-propagation:阻止 hover-class 冒泡向外传播-->
        <!-- hover-start-time:点击后,延迟多久生效 -->
        <!-- hover-stay-time:保持效果多长时间 -->
        <view class="box" hover-class="box-active" hover-stop-propagation :hover-start-time="2000" :hover-stay-time="2000">
            我是一个大盒子
        </view>
    </view>
</template>
<script>
</script>
<style>
    .box {
        width: 200px;
        height: 100px;
        background: green;
    }
    .box-active {
        background: red;
    }
    .box2 {
        width: 220px;
        height: 120px;
        background: blue;
    }
    .box-active2 {
        background: pink;
    }
</style>

2 效果

三 button 组件

1 代码

<template>
    <view>
        <view class="box2" hover-class="box-active2">
            <!-- hover-class:按下去的样式 -->
            <!-- hover-stop-propagation:阻止 hover-class 冒泡向外传播-->
            <!-- hover-start-time:点击后,延迟多久生效 -->
            <!-- hover-stay-time:保持效果多长时间 -->
            <view class="box" hover-class="box-active" hover-stop-propagation :hover-start-time="2000" :hover-stay-time="2000">
                我是一个大盒子
            </view>
        </view>
        <button>默认按钮</button>
        <button size="mini">小按钮</button>
        <button type="primary">样式按钮</button>
        <button plain="">镂空按钮</button>
        <button disabled="">禁用按钮</button>
        <button loading>loading按钮</button>
    </view>
</template>
<script>
</script>
<style>
    .box {
        width: 200px;
        height: 100px;
        background: green;
    }
    .box-active {
        background: red;
    }
    .box2 {
        width: 220px;
        height: 120px;
        background: blue;
    }
    .box-active2 {
        background: pink;
    }
</style>

2 效果

四 image 组件

1 代码

<template>
    <view>
        <view class="box2" hover-class="box-active2">
            <!-- hover-class:按下去的样式 -->
            <!-- hover-stop-propagation:阻止 hover-class 冒泡向外传播-->
            <!-- hover-start-time:点击后,延迟多久生效 -->
            <!-- hover-stay-time:保持效果多长时间 -->
            <view class="box" hover-class="box-active" hover-stop-propagation :hover-start-time="2000" :hover-stay-time="2000">
                我是一个大盒子
            </view>
        </view>
        <button>默认按钮</button>
        <button size="mini">小按钮</button>
        <button type="primary">样式按钮</button>
        <button plain="">镂空按钮</button>
        <button disabled="">禁用按钮</button>
        <button loading>loading按钮</button>
        <image src="../../static/tabs/1237644.png"></image>
        <!-- aspectFit:保持纵横比缩放图片,使图片的长边能完全显示出来。也就是说,可以完整地将图片显示出来。 -->
        <!-- aspectFill:保持纵横比缩放图片,只保证图片的短边能完全显示出来。也就是说,图片通常只在水平或垂直方向是完整的,另一个方向将会发生截取。 -->
        <image src="../../static/tabs/1237644.png" mode="aspectFit"></image>
        <image src="../../static/tabs/1237644.png" mode="aspectFill"></image>
    </view>
</template>
<script>
</script>
<style>
    .box {
        width: 200px;
        height: 100px;
        background: green;
    }


    .box-active {
        background: red;
    }


    .box2 {
        width: 220px;
        height: 120px;
        background: blue;
    }


    .box-active2 {
        background: pink;
    }
</style>

2 效果

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值