基础布局组件(微信小程序)

目录

1.view标签

类似于HTML里面的div标签,块级元素

2.text标签

3.image标签

<view class="box" hover-class="boxHover">天下我有</view>
<text>人生苦短,去日苦多</text>
<image src="/images/pic.jpeg" mode="aspectFit" show-menu-by-longpress></image>
.box {
  width: 100px;
  height: 100px;
  background-color: gold;
  margin-right: 2px;
  flex: 0 0 100px;
}

.boxHover {
  background-color: red;
}

image {
  width: 100%;
}

 

4.button标签

<button type="primary" class="btn" plain>登录</button>
<button type="default" class="btn" size="mini" >提交</button>
<button type="warn" class="btn">退出登录</button>
<button type="primary" class="btn" loading>加载中</button>
.btn {
  margin: 5px;
}

5.scroll-view标签

做滚动视图的

index.wxml 

<scroll-view scroll-x scroll-left="100">
  <view class="scrOut">
    <view class="box">1111</view>
    <view class="box">2222</view>
    <view class="box">3333</view>
    <view class="box">4444</view>
    <view class="box">5555</view>
  </view>
</scroll-view>

<scroll-view scroll-y scroll-top="100">
  <view class="scrOut2">
    <view class="box2">1111</view>
    <view class="box2">2222</view>
    <view class="box2">3333</view>
    <view class="box2">4444</view>
    <view class="box2">5555</view>
  </view>
</scroll-view>

index.wxss 

.box {
  width: 100px;
  height: 100px;
  background-color: gold;
  margin-right: 2px;
  flex: 0 0 100px;
}

.scrOut {
  border: 1px solid rgb(128, 0, 6);
  display: flex;
  flex-wrap: nowrap;
}

.box2 {
  width: 100%;
  height: 100px;
  background-color: pink;
  margin-bottom: 1px;
}

.scrOut2 {
  height: 380px;
  border: 1px solid rgb(128, 0, 6);
}

6.icon标签

做图标的

<view style="text-align: center;padding: 50px;">
  <icon type="success" size="30"></icon>
  <view>提交成功,谢谢您的配合!</view>
</view>

 

7.progress标签

做进度条的

<view style="padding: 50px;">
  <progress percent="60" show-info font-size="16px" border-radius="10" activeColor="pink" backgroundColor="#eee" active></progress>
</view>

 

 8.form标签

<form bindsubmit="onSubmit">
  <input class="ipt" placeholder="请输入用户名" auto-focus></input>
  <button form-type="submit">提交</button>
</form>
.ipt {
  border: 1px solid black;
  padding: 0 10px;
}

9.swiper标签

滑块容器,可用来做轮播图 

<swiper class="banner" indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#fff" autoplay interval="3000" circular>
  <swiper-item>
    <image src="/images/1.jpeg" mode="widthFix"></image>
  </swiper-item>
  <swiper-item>
    <image src="/images/2.jpeg" mode="widthFix"></image>
  </swiper-item>
  <swiper-item>
    <image src="/images/3.jpeg" mode="widthFix"></image>
  </swiper-item>
</swiper>
.banner {
  height: 140px;
  border: 1px solid red;
}
.banner image{
  width: 100%;
}

  

10.navigator标签

类似于a标签,可用于小程序内部的跳转或者小程序之间的跳转

<view>
  <navigator url="/pages/logs/logs">跳转到日志</navigator>
</view>

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

漂流の少年

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值