微信小程序纵向布局

微信小程序纵向布局可通过设置flex-direction为column实现,同时使用flex属性控制子元素的大小和位置。

微信小程序扩展组件·纵向选项卡组件

翔安网站制作公司哪家好,找成都创新互联公司!从网页设计、网站建设、微信开发、APP开发、响应式网站建设等网站项目制作,到程序开发,运营维护。成都创新互联公司成立于2013年到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选成都创新互联公司

微信小程序作为一款轻量级的应用,其功能丰富且易于开发,在微信小程序中,我们可以使用各种扩展组件来丰富应用的功能,本文将介绍一种常用的扩展组件——纵向选项卡组件。

纵向选项卡组件简介

纵向选项卡组件是一种常见的UI组件,它可以在一个页面中展示多个选项,用户可以通过点击不同的选项切换到不同的页面或内容,这种组件通常用于展示多个相关的内容,方便用户快速浏览和选择。

纵向选项卡组件的使用方法

1、在小程序的app.json文件中,添加"usingComponents"字段,声明要使用的纵向选项卡组件:

{
  "usingComponents": {
    "vantabs": "path/to/vantweapp/dist/tabs/index"
  }
}

2、在需要使用纵向选项卡组件的页面的json文件中,引入组件:

{
  "usingComponents": {
    "vantab": "path/to/vantweapp/dist/tabs/index"
  }
}

3、在页面的wxml文件中,添加纵向选项卡组件:


  内容1
  内容2
  内容3

纵向选项卡组件的属性和方法

1、属性:

属性名类型默认值说明
activeNumber0当前激活的标签索引,从0开始
animatedBooleantrue是否开启动画效果
durationNumber300动画时长,单位为毫秒
colorString#999999标题颜色
fontSizeNumber14标题字体大小
backgroundColorString#ffffff背景颜色
borderStyleStringsolid边框样式
borderColorString#eeeeee边框颜色
lineHeightNumber50行高,单位为rpx
radiusNumber8圆角大小,单位为rpx
scrollableBooleanfalse是否开启滚动条
lazyLoadBooleanfalse是否开启懒加载
showIndicatorBooleantrue是否显示指示器
leftIconColorString#999999左侧图标颜色(仅适用于自定义图标)
rightIconColorString#999999右侧图标颜色(仅适用于自定义图标)
fixedColorString#1aad19固定态的颜色(仅适用于自定义图标)
activeColorString#1aad19激活态的颜色(仅适用于自定义图标)
disabledColorString#cccccc禁用态的颜色(仅适用于自定义图标)
fontWeightStringnormal标题字体粗细,可选值为normal、bold、bolder、lighter、100、200、300、400、500、600、700、800、900、inherit等
fontStyleStringnormal标题字体样式,可选值为normal、italic、oblique等
textAlignStringcenter标题对齐方式,可选值为left、center、right等

| customIconsLeft / customIconsRight / customIconsTop / customIconsBottom / customIconsInactiveText / customIconsActiveText / customIconsInactiveColor / customIconsActiveColor / customIconsInactiveSize / customIconsActiveSize / customIconsInactiveFontFamily / customIconsActiveFontFamily / customIconsInactiveLineHeight / customIconsActiveLineHeight / customIconsInactiveFontWeight / customIconsActiveFontWeight / customIconsInactiveFontStyle / customIconsActiveFontStyle (仅适用于自定义图标) Custom icons for the tab bar, can be set individually for each tab. These properties are only valid when using the custom type of tab. For more information, please refer to the official documentation.

| zIndex Number The zindex of the tab bar, default is auto. This property is only valid when using the custom type of tab. For more information, please refer to the official documentation.

| safeAreaInsetBottom Number The bottom inset of the safe area, default is auto. This property is only valid when using the custom type of tab. For more information, please refer to the official documentation.

| safeAreaInsetTop Number The top inset of the safe area, default is auto. This property is only valid when using the custom type of tab. For more information, please refer to the official documentation.

| safeAreaInsetLeft Number The left inset of the safe area, default is auto. This property is only valid when using the custom type of tab. For more information, please refer to the official documentation.

| safeAreaInsetRight Number The right inset of the safe area, default is auto. This property is only valid when using the custom type of tab. For more information, please refer to the official documentation.

| safeAreaBackgroundColor Color The background color of the safe area, default is transparent. This property is only valid when using the custom type of tab. For more information, please refer to the official documentation.

| safeAreaBackgroundImage Image The background image of the safe area, default is none. This property is only valid when using the custom type of tab. For more information, please refer to the official documentation.

| safeAreaCustomBackgroundColor Color The background color of the safe area when it overlaps with the content, default is transparent. This property is only valid when using the custom type of tab. For more information, please refer to the official documentation.

| safeAreaCustomBackgroundImage Image The background image of the safe area when it overlaps with the content, default is none. This property是纵向选项卡组件的使用方法,在小程序的app.json文件中,添加"usingComponents"字段,声明要使用的纵向选项卡组件:
<

“`json

{

"usingComponents": {

"vantabs": "path/to/vantweapp/dist/tabs/index"

}

}

“`

在需要使用纵向选项卡组件的页面的json文件中,引入组件:

“`json

{

"usingComponents": {

"vantab": "path/to/vantweapp/dist/tabs/index"

}

}

“`

在页面的wxml文件中,添加纵向选项卡组件:

“`html

内容1

内容2

内容3

“`

纵向选项卡组件的属性和方法

1、属性:

| 属性名 | 类型 | 默认值 | 说明 |

||||

| active | Number | 当前激活的标签索引,从0开始 | 当前激活的标签索引,从0开始 |

| animated | Boolean | true | true表示开启动画效果,false表示关闭动画效果 |

| duration | Number | 300 | animationDuration属性指定动画时长,单位为ms |

| color | String | #999999 | title文字颜色 |

| fontSize | Number | 14 | title文字大小

本文名称:微信小程序纵向布局
浏览地址:http://www.shufengxianlan.com/qtweb/news2/401002.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联