最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序的宿主環(huán)境實現(xiàn)代碼

 更新時間:2022年10月06日 09:52:44   作者:H·976  
這篇文章主要介紹了微信小程序的宿主環(huán)境,包括scroll-view 組件的基本使用,text 組件的基本使用及rich-text 組件的基本使用,本文通過示例代碼給大家介紹的非常詳細,需要的朋友可以參考下

??小程序的宿主環(huán)境 - 組件

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

實現(xiàn)如圖的縱向滾動效果

<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

實現(xiàn)如圖的橫向滾動效果:

 <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 組件的基本使用

實現(xiàn)如圖的輪播圖效果:

<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

booleanfalse是否顯示面板指示點
indicator-colorcolorrgba(0, 0, 0, .3)指示點顏色
indicator-active-colorcolor#000000當前選中的指示點顏色
autoplaybooleanfalse是否自動切換
intervalnumber5000自動切換時間間隔
circularbooleanfalse是否采用銜接滑動

3.text 組件的基本使用

文本組件

類似于 HTML 中的 span 標簽,是一個行內(nèi)元素

通過 text 組件的 selectable 屬性,實現(xiàn)長按選中文本內(nèi)容的效果:

<view>
手機號:
<text selectable>17608777</text>
</view>

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

富文本組件

支持把 HTML 字符串渲染為 WXML 結(jié)構(gòu)

<rich-text nodes="<h1 style='color:pink;'>一級標題 <h1>"></rich-text>

到此這篇關(guān)于微信小程序的宿主環(huán)境的文章就介紹到這了,更多相關(guān)小程序宿主環(huán)境內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

龙陵县| 珠海市| 仲巴县| 商丘市| 无锡市| 佛教| 肥西县| 巩义市| 丽江市| 绥棱县| 扎赉特旗| 枣庄市| 丽江市| 江西省| 安泽县| 普安县| 北碚区| 天峨县| 阿克陶县| 巩义市| 宁阳县| 昌江| 靖江市| 施秉县| 和静县| 义马市| 若尔盖县| 新民市| 扬中市| 长泰县| 健康| 崇信县| 河源市| 江津市| 信阳市| 慈溪市| 宁津县| 明溪县| 波密县| 石棉县| 东明县|