更新记录

0.1.9(2026-08-18) 下载此版本

  • 蒸汽模式兼容:移除 .nax-swiper__text.nax-swiper__number-text 中已废弃的 lines: 1 声明(仅 VDOM 支持,Vapor 下告警),改用 <text>:max-lines="1" 属性

0.1.8(2026-08-14) 下载此版本

  • readme 新增“list 项”字段说明表(src/image/url、text/title、bg/background 及优先级)

0.1.5(2026-08-07) 下载此版本

  • 兼容性声明:补充 iOS(APP-IOS)端支持,package.json 平台标记同步为
查看更多

平台兼容性

uni-app x(4.25)

Chrome Safari Android iOS 鸿蒙 微信小程序

其他

多语言 暗黑模式 宽屏模式
× ×

nax-swiper

nax-ui 轮播组件(uni-app x / uvue)。

基于原生 swiper / swiper-item 封装,提供统一 API、主题圆角与数字指示器。

安装

uni_modules/nax-swiper

easycom 自动生效。

推荐同时安装主题包

uni_modules/nax-ui-theme

并在 App.uvue 引入:

@import "@/uni_modules/nax-ui-theme/theme/default.css";

页面根节点加 class="nax-theme"

主题

通过 CSS 变量覆盖:

Token 用途
--nax-color-bg-secondary 次级背景色
--nax-color-text-inverse 反白文字色
--nax-swiper-number-bg 数字指示器背景色
--nax-swiper-number-color 数字指示器文字色
--nax-swiper-radius 轮播圆角

依赖

依赖 说明
nax-ui-theme 安装时依赖(下载本插件时建议自动带上);运行时弱依赖(未 @import / 未挂 nax-theme 时组件走 fallback)

安装 theme 后仍需:App.uvue @import + 应用 layout/页面 一处 class="nax-theme"。详见 uni_modules/nax-ui-theme/readme.md(L0/L1/L2)。

基础用法

<nax-swiper :list="banners" height="180" indicator></nax-swiper>
const banners = ref([
  'https://example.com/1.jpg',
  'https://example.com/2.jpg',
  'https://example.com/3.jpg'
] as string[])

自动播放 / 循环

<nax-swiper
  :list="banners"
  autoplay
  :interval="3000"
  circular
  height="180"
></nax-swiper>

受控 current

<nax-swiper
  :list="banners"
  v-model:current="current"
  height="180"
  @change="onChange"
></nax-swiper>

数字指示器

<nax-swiper
  :list="banners"
  indicator
  indicator-type="number"
  indicator-position="bottom-right"
  height="180"
></nax-swiper>

色块 / 文案项(推荐,微信小程序友好)

<nax-swiper :list="panels" height="140"></nax-swiper>
const panels = ref([
  { bg: '#18a058', text: '页 1' } as UTSJSONObject,
  { bg: '#18a058', text: '页 2' } as UTSJSONObject
] as UTSJSONObject[])

自定义 swiper-item(默认插槽)

list 为空时可用默认插槽。微信小程序必须传 itemCount(等于你写的 swiper-item 个数),否则可能报:

display-multiple-items 不能大于 swiper-item 数量

<nax-swiper height="160" :list="[]" :item-count="2" :indicator="false">
  <swiper-item>
    <view class="slide"><text>自定义 1</text></view>
  </swiper-item>
  <swiper-item>
    <view class="slide"><text>自定义 2</text></view>
  </swiper-item>
</nax-swiper>

小程序端更推荐用 list + bg/text,避免 slot 投影导致 item 计数异常。

Props

属性 类型 默认值 说明
list array [] 图片 url,或含 src/image/url/text/bg 的对象
current number 0 当前页(可用 v-model:current
height string 160 高度;纯数字按 px
autoplay boolean false 自动播放
interval number 3000 自动切换间隔 ms
duration number 500 动画时长 ms
circular boolean true 循环衔接
vertical boolean false 纵向
indicator boolean true 显示指示器
indicatorType string dot dot / number
indicatorColor string '' 指示点颜色(dot)
indicatorActiveColor string '' 当前指示点颜色(dot)
indicatorPosition string bottom number 指示器位置
imageMode string aspectFill image mode
previousMargin string 0px 前边距
nextMargin string 0px 后边距
displayMultipleItems number 1 同时显示滑块数(会按 item 数钳制)
itemCount number 0 自定义 swiper-item 数量(list 为空时建议必传)
disableTouch boolean false 禁止手势
radius boolean true 圆角
customClass string '' 根节点扩展 class

list 项

list 元素支持字符串(图片 url)或对象,对象字段如下:

字段 类型 说明
src / image / url string 图片地址,优先级 src > image > url;字符串元素等价于传 src
bg / background string 背景色,优先级 bg > background;无图片时配合 text 渲染色块文案
text / title string 文案,优先级 text > title;可叠加在图片上,或配合 bg 组成色块项

Events

事件 说明
change 页码变化,参数 current
update:current 同步 v-model:current
animationfinish 动画结束,参数 current
click 点击某一项,参数 index(list 模式)

Slots

插槽 说明
default 自定义 swiper-itemlist 为空时;小程序请传 itemCount

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。