首页IT科技宿舍玩的微信小程序(微信小程序的宿主环境实现代码)

宿舍玩的微信小程序(微信小程序的宿主环境实现代码)

时间2025-06-20 09:46:55分类IT科技浏览4199
导读:?小程序的宿主环境 - 组件 1.scroll-view 组件的基本使用...

?小程序的宿主环境 - 组件

1.scroll-view 组件的基本使用

实现如图的纵向滚动效果

<scroll-view class="container_2" scroll-y> <view>T</view> <view>S</view> <view>J</view> </scroll-view>
.container_2 view{ width: 100px; height: 100px; text-align: center; line-height: 100px; } .container_2 view:nth-child(1){ background-color: red; } .container_2 view:nth-child(2){ background-color: yellowgreen; } .container_2 view:nth-child(3){ background-color: blue; } .container_2{ display: flex; justify-content: space-around } .container_2{ border: 1px solid yellowgreen; height: 130px; width: 100px; }

scroll-y 改成scroll-x

实现如图的横向滚动效果:

<scroll-view class="container_2" scroll-x> <view>横 向 滑 动 演 示</view> </scroll-view>
.container_2 view{ width: 300px; height: 100px; text-align: center; line-height: 100px; } .container_2 view:nth-child(1){ background-color: red; } .container_2{ display: flex; justify-content: space-around } .container_2{ border: 1px solid yellowgreen; height: 100px; width: 100px; }

2.swiper 和 swiper-item 组件的基本使用

实现如图的轮播图效果:

<swiper class="container_3" indicator-dots> <swiper-item> <view class="item">1</view> </swiper-item> <swiper-item> <view class="item">2</view> </swiper-item> <swiper-item> <view class="item">3</view> </swiper-item> <swiper-item> <view class="item">4</view> </swiper-item> </swiper>
.container_3{ height: 160px; } .item{ height: 100%; line-height: 150px; text-align: center; } swiper-item:nth-child(1) .item{ background-color: burlywood; } swiper-item:nth-child(2) .item{ background-color: yellow; } swiper-item:nth-child(3) .item{ background-color: pink; } swiper-item:nth-child(4) .item{ background-color: aqua; }

.swiper 组件的常用属性

属性

类型

默认值

说明

indicator-dots

boolean false 是否显示面板指示点 indicator-color color rgba(0, 0, 0, .3) 指示点颜色 indicator-active-color color #000000 当前选中的指示点颜色 autoplay boolean false 是否自动切换 interval number 5000 自动切换时间间隔 circular boolean false 是否采用衔接滑动

3.text 组件的基本使用

文本组件

类似于 HTML 中的 span 标签           ,是一个行内元素

通过 text 组件的 selectable 属性                ,实现长按选中文本内容的效果:

<view> 手机号: <text selectable>17608777</text> </view>

4.rich-text 组件的基本使用

富文本组件

支持把 HTML 字符串渲染为 WXML 结构

<rich-text nodes="<h1>一级标题 <h1>"></rich-text>

到此这篇关于微信小程序的宿主环境的文章就介绍到这了,更多相关小程序宿主环境内容请搜索本站以前的文章或继续浏览下面的相关文章希望大家以后多多支持本站!

声明:本站所有文章      ,如无特殊说明或标注      ,均为本站原创发布           。任何个人或组织                ,在未征得本站同意时           ,禁止复制           、盗用                 、采集     、发布本站内容到任何网站           、书籍等各类媒体平台                 。如若本站内容侵犯了原著者的合法权益      ,可联系我们进行处理     。

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
springboot-resttemplate(RESTful风格与Spring注解)