@fredwsw/frontend-rules 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +302 -0
  2. package/bin/cli.js +155 -0
  3. package/package.json +22 -0
  4. package/template/docs/uv-ui-docs/action-sheet-cn.md +180 -0
  5. package/template/docs/uv-ui-docs/album-cn.md +104 -0
  6. package/template/docs/uv-ui-docs/alert-cn.md +71 -0
  7. package/template/docs/uv-ui-docs/avatar-cn.md +149 -0
  8. package/template/docs/uv-ui-docs/back-top-cn.md +121 -0
  9. package/template/docs/uv-ui-docs/badge-cn.md +100 -0
  10. package/template/docs/uv-ui-docs/button-cn.md +181 -0
  11. package/template/docs/uv-ui-docs/calendar-cn.md +179 -0
  12. package/template/docs/uv-ui-docs/calendars-cn.md +264 -0
  13. package/template/docs/uv-ui-docs/cell-cn.md +163 -0
  14. package/template/docs/uv-ui-docs/checkbox-cn.md +164 -0
  15. package/template/docs/uv-ui-docs/code-cn.md +122 -0
  16. package/template/docs/uv-ui-docs/code-input-cn.md +127 -0
  17. package/template/docs/uv-ui-docs/collapse-cn.md +206 -0
  18. package/template/docs/uv-ui-docs/color-cn.md +122 -0
  19. package/template/docs/uv-ui-docs/count-down-cn.md +169 -0
  20. package/template/docs/uv-ui-docs/count-to-cn.md +125 -0
  21. package/template/docs/uv-ui-docs/datetime-picker-cn.md +167 -0
  22. package/template/docs/uv-ui-docs/divider-cn.md +90 -0
  23. package/template/docs/uv-ui-docs/drop-down-cn.md +287 -0
  24. package/template/docs/uv-ui-docs/empty-cn.md +76 -0
  25. package/template/docs/uv-ui-docs/form-cn.md +220 -0
  26. package/template/docs/uv-ui-docs/gap-cn.md +63 -0
  27. package/template/docs/uv-ui-docs/grid-cn.md +187 -0
  28. package/template/docs/uv-ui-docs/icon-cn.md +255 -0
  29. package/template/docs/uv-ui-docs/image-cn.md +170 -0
  30. package/template/docs/uv-ui-docs/index-list-cn.md +132 -0
  31. package/template/docs/uv-ui-docs/input-cn.md +157 -0
  32. package/template/docs/uv-ui-docs/keyboard-cn.md +156 -0
  33. package/template/docs/uv-ui-docs/layout-cn.md +215 -0
  34. package/template/docs/uv-ui-docs/line-cn.md +77 -0
  35. package/template/docs/uv-ui-docs/line-progress-cn.md +132 -0
  36. package/template/docs/uv-ui-docs/link-cn.md +97 -0
  37. package/template/docs/uv-ui-docs/list-cn.md +185 -0
  38. package/template/docs/uv-ui-docs/load-more-cn.md +144 -0
  39. package/template/docs/uv-ui-docs/loading-icon-cn.md +125 -0
  40. package/template/docs/uv-ui-docs/loading-page-cn.md +85 -0
  41. package/template/docs/uv-ui-docs/modal-cn.md +212 -0
  42. package/template/docs/uv-ui-docs/navbar-cn.md +171 -0
  43. package/template/docs/uv-ui-docs/no-network-cn.md +112 -0
  44. package/template/docs/uv-ui-docs/notice-bar-cn.md +119 -0
  45. package/template/docs/uv-ui-docs/notify-cn.md +185 -0
  46. package/template/docs/uv-ui-docs/number-box-cn.md +131 -0
  47. package/template/docs/uv-ui-docs/overlay-cn.md +122 -0
  48. package/template/docs/uv-ui-docs/parse-cn.md +177 -0
  49. package/template/docs/uv-ui-docs/pick-color-cn.md +147 -0
  50. package/template/docs/uv-ui-docs/picker-cn.md +159 -0
  51. package/template/docs/uv-ui-docs/popup-cn.md +184 -0
  52. package/template/docs/uv-ui-docs/qrcode-cn.md +150 -0
  53. package/template/docs/uv-ui-docs/radio-cn.md +166 -0
  54. package/template/docs/uv-ui-docs/rate-cn.md +91 -0
  55. package/template/docs/uv-ui-docs/read-more-cn.md +191 -0
  56. package/template/docs/uv-ui-docs/scroll-list-cn.md +188 -0
  57. package/template/docs/uv-ui-docs/search-cn.md +107 -0
  58. package/template/docs/uv-ui-docs/skeleton-cn.md +101 -0
  59. package/template/docs/uv-ui-docs/skeletons-cn.md +312 -0
  60. package/template/docs/uv-ui-docs/slider-cn.md +98 -0
  61. package/template/docs/uv-ui-docs/steps-cn.md +158 -0
  62. package/template/docs/uv-ui-docs/sticky-cn.md +82 -0
  63. package/template/docs/uv-ui-docs/subsection-cn.md +161 -0
  64. package/template/docs/uv-ui-docs/swipe-action-cn.md +207 -0
  65. package/template/docs/uv-ui-docs/swiper-cn.md +247 -0
  66. package/template/docs/uv-ui-docs/switch-cn.md +136 -0
  67. package/template/docs/uv-ui-docs/tabbar-cn.md +224 -0
  68. package/template/docs/uv-ui-docs/tabs-cn.md +260 -0
  69. package/template/docs/uv-ui-docs/tags-cn.md +191 -0
  70. package/template/docs/uv-ui-docs/text-cn.md +178 -0
  71. package/template/docs/uv-ui-docs/textarea-cn.md +132 -0
  72. package/template/docs/uv-ui-docs/toast-cn.md +110 -0
  73. package/template/docs/uv-ui-docs/tooltip-cn.md +91 -0
  74. package/template/docs/uv-ui-docs/transition-cn.md +202 -0
  75. package/template/docs/uv-ui-docs/upload-cn.md +156 -0
  76. package/template/docs/uv-ui-docs/vtabs-cn.md +190 -0
  77. package/template/docs/uv-ui-docs/waterfall-cn.md +276 -0
  78. package/template/rules/common.mdc +90 -0
  79. package/template/rules/uv-ui-docs.mdc +111 -0
  80. package/template/skills/code-simplifier/SKILL.md +109 -0
  81. package/template/skills/frontend-design/SKILL.md +44 -0
@@ -0,0 +1,212 @@
1
+ ---
2
+ group: 反馈
3
+ category: Components
4
+ title: Modal
5
+ subtitle: 模态框
6
+ description: 用于消息提示与确认操作的弹窗组件,支持富文本、自定义按钮、异步关闭与缩放动画。
7
+ demo:
8
+ cols: 2
9
+ ---
10
+
11
+ ## 何时使用 {#when-to-use}
12
+
13
+ `uv-modal` 用于消息提示、消息确认、在当前页面内完成特定交互操作,类似 `uni.showModal` 的组件化版本:
14
+
15
+ - 支持标题、内容、确认/取消按钮
16
+ - 支持 slot 传入富文本内容
17
+ - 支持自定义确认按钮、异步关闭、缩放效果等
18
+
19
+ > 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
20
+
21
+ ## 平台兼容性 {#platform}
22
+
23
+ | App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
24
+ | --- | --- | --- | --- | --- | --- |
25
+ | √ | √ | √ | √ | √ | √ |
26
+
27
+ **组件名:** `uv-modal`
28
+
29
+ ## 代码演示 {#examples}
30
+
31
+ ### 基本使用 {#basic}
32
+
33
+ 默认只有一个确认按钮,需至少配置 `content`;通过 `ref` 调用 `open()` 控制显示。
34
+
35
+ ```vue
36
+ <template>
37
+ <view>
38
+ <uv-modal ref="modal" title="标题" content="不知天上宫阙,今夕是何年" @confirm="confirm"></uv-modal>
39
+ <button @click="openModal">打开</button>
40
+ </view>
41
+ </template>
42
+
43
+ <script>
44
+ export default {
45
+ methods: {
46
+ openModal() {
47
+ this.$refs.modal.open()
48
+ },
49
+ confirm() {
50
+ console.log('点击确认按钮')
51
+ }
52
+ }
53
+ }
54
+ </script>
55
+ ```
56
+
57
+ ### 传入富文本内容 {#rich-text}
58
+
59
+ 通过 slot + `rich-text` 传入富文本内容。
60
+
61
+ ```vue
62
+ <template>
63
+ <view>
64
+ <uv-modal ref="modal" title="标题" @confirm="confirm">
65
+ <view class="slot-content">
66
+ <rich-text :nodes="content"></rich-text>
67
+ </view>
68
+ </uv-modal>
69
+ <button @click="openModal">打开</button>
70
+ </view>
71
+ </template>
72
+
73
+ <script>
74
+ export default {
75
+ data() {
76
+ return {
77
+ content: `<p style="max-height:30px;overflow:auto;">空山新雨后<br>天气晚来秋空山</p>`
78
+ }
79
+ },
80
+ methods: {
81
+ openModal() {
82
+ this.$refs.modal.open()
83
+ },
84
+ confirm() {
85
+ console.log('点击确认按钮')
86
+ }
87
+ }
88
+ }
89
+ </script>
90
+ ```
91
+
92
+ ### 自定义确定按钮 {#confirm-button}
93
+
94
+ 常用于微信小程序弹窗授权等场景,通过 `confirmButton` 插槽自定义按钮,并手动 `close()`。
95
+
96
+ ```vue
97
+ <template>
98
+ <view>
99
+ <uv-modal ref="modal" title="水调歌头" content="不知天上宫阙,今夕是何年" @confirm="confirm">
100
+ <template v-slot:confirmButton>
101
+ <button type="default" @click="closeModal">自定义按钮</button>
102
+ </template>
103
+ </uv-modal>
104
+ <button @click="openModal">打开</button>
105
+ </view>
106
+ </template>
107
+
108
+ <script>
109
+ export default {
110
+ methods: {
111
+ openModal() {
112
+ this.$refs.modal.open()
113
+ },
114
+ closeModal() {
115
+ this.$refs.modal.close()
116
+ },
117
+ confirm() {
118
+ console.log('点击确认按钮')
119
+ }
120
+ }
121
+ }
122
+ </script>
123
+ ```
124
+
125
+ ### 异步关闭 {#async-close}
126
+
127
+ 仅对“确定”按钮生效。设置 `asyncClose` 为 true 后,点击确定会显示 loading,需手动调用 `close()` 或 `closeLoading()`。
128
+
129
+ ```vue
130
+ <template>
131
+ <view>
132
+ <uv-modal
133
+ ref="modal"
134
+ title="水调歌头"
135
+ content="不知天上宫阙,今夕是何年"
136
+ :asyncClose="true"
137
+ @confirm="confirm"
138
+ ></uv-modal>
139
+ <button @click="openModal">打开</button>
140
+ </view>
141
+ </template>
142
+
143
+ <script>
144
+ export default {
145
+ methods: {
146
+ openModal() {
147
+ this.$refs.modal.open()
148
+ },
149
+ confirm() {
150
+ console.log('点击确认按钮')
151
+ setTimeout(() => {
152
+ this.$refs.modal.close()
153
+ }, 2000)
154
+ }
155
+ }
156
+ }
157
+ </script>
158
+ ```
159
+
160
+ ### 控制宽度与缩放效果 {#width-zoom}
161
+
162
+ ```vue
163
+ <uv-modal ref="modal" content="不知天上宫阙,今夕是何年" width="500rpx"></uv-modal>
164
+ <uv-modal ref="modal" content="不知天上宫阙,今夕是何年" :zoom="false"></uv-modal>
165
+ ```
166
+
167
+ ## API {#api}
168
+
169
+ ### Modal Props {#props}
170
+
171
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
172
+ | --- | --- | --- | --- | --- |
173
+ | title | 标题内容 | String | - | - |
174
+ | content | 文本内容(传入 slot 时无效) | String | - | - |
175
+ | confirmText | 确认按钮文字 | String | 确认 | - |
176
+ | cancelText | 取消按钮文字 | String | 取消 | - |
177
+ | showConfirmButton | 是否显示确认按钮 | Boolean | true | true \| false |
178
+ | showCancelButton | 是否显示取消按钮 | Boolean | false | true \| false |
179
+ | confirmColor | 确认按钮颜色 | String | #2979ff | - |
180
+ | cancelColor | 取消按钮颜色 | String | #606266 | - |
181
+ | buttonReverse | 是否对调确认和取消位置 | Boolean | false | true \| false |
182
+ | zoom | 是否开启缩放模式 | Boolean | true | true \| false |
183
+ | asyncClose | 是否异步关闭(仅确认按钮) | Boolean | false | true \| false |
184
+ | closeOnClickOverlay | 是否允许点击遮罩关闭 | Boolean | true | true \| false |
185
+ | negativeTop | 往上偏移值(避免与键盘重合;单位任意) | String \| Number | 0 | - |
186
+ | width | 宽度(不支持百分比,px/rpx) | String \| Number | 650rpx | - |
187
+ | zIndex | 弹出层层级 | Number \| String | 10075 | - |
188
+ | align | 文本对齐方式 | String | left | left \| center \| right |
189
+ | textStyle | 文本扩展样式 | Object | - | - |
190
+
191
+ ### Modal Methods {#methods}
192
+
193
+ | 方法名 | 说明 |
194
+ | --- | --- |
195
+ | open | 打开模态框 |
196
+ | close | 关闭模态框 |
197
+ | closeLoading | 在 `asyncClose` 场景下仅关闭 loading 状态 |
198
+
199
+ ### Modal Events {#events}
200
+
201
+ | 事件名 | 说明 | 回调参数 |
202
+ | --- | --- | --- |
203
+ | @confirm | 点击确认按钮时触发 | - |
204
+ | @cancel | 点击取消按钮时触发 | - |
205
+ | @close | 关闭模态框时触发 | - |
206
+
207
+ ### Modal Slots {#slots}
208
+
209
+ | 名称 | 说明 |
210
+ | --- | --- |
211
+ | default | 自定义内容(通常为富文本) |
212
+ | confirmButton | 自定义确认按钮(如小程序授权按钮等) |
@@ -0,0 +1,171 @@
1
+ ---
2
+ group: 导航
3
+ category: Components
4
+ title: Navbar
5
+ subtitle: 自定义导航栏
6
+ description: 在需要自定义头部导航时使用的组件,支持标题、返回按钮、自定义左右内容和多种背景样式。
7
+ demo:
8
+ cols: 2
9
+ ---
10
+
11
+ ## 何时使用 {#when-to-use}
12
+
13
+ `uv-navbar` 常用于需要 **自定义导航栏** 的场景,例如:
14
+
15
+ - 使用自定义头部而隐藏 uni-app 默认导航栏
16
+ - 需要更复杂的返回区域、自定义按钮、搜索框等内容
17
+
18
+ 一般情况建议优先使用 uni-app 自带导航栏,只有在定制需求较强时再使用本组件。
19
+
20
+ > 自定义导航栏前,需要在 `pages.json` 中关闭系统导航栏并设置状态栏文字颜色。
21
+ > 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
22
+
23
+ ## 平台兼容性 {#platform}
24
+
25
+ | App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
26
+ | --- | --- | --- | --- | --- | --- |
27
+ | √ | √ | √ | √ | √ | √ |
28
+
29
+ **组件名:** `uv-navbar`
30
+
31
+ ## 预置配置(pages.json) {#pages-json}
32
+
33
+ ```json
34
+ "pages": [
35
+ {
36
+ "path": "/pages/navbar/index",
37
+ "style": {
38
+ "navigationStyle": "custom",
39
+ "navigationBarTextStyle": "white"
40
+ }
41
+ }
42
+ ]
43
+ ```
44
+
45
+ ## 代码演示 {#examples}
46
+
47
+ ### 基本使用 {#basic}
48
+
49
+ 默认仅显示一个左侧返回箭头,并在点击时触发 `@leftClick`。
50
+
51
+ ```vue
52
+ <template>
53
+ <view>
54
+ <uv-navbar title="个人中心" @leftClick="leftClick"></uv-navbar>
55
+ </view>
56
+ </template>
57
+
58
+ <script>
59
+ export default {
60
+ methods: {
61
+ leftClick() {
62
+ console.log('leftClick')
63
+ }
64
+ }
65
+ }
66
+ </script>
67
+ ```
68
+
69
+ ### 自定义左侧区域 {#left-slot}
70
+
71
+ 通过 `left` 插槽可将返回区域全部自定义。
72
+
73
+ ```vue
74
+ <template>
75
+ <view>
76
+ <uv-navbar leftText="返回" :fixed="false" title="个人中心" :safeAreaInsetTop="false">
77
+ <template v-slot:left>
78
+ <view class="uv-nav-slot">
79
+ <uv-icon name="arrow-left" size="19"></uv-icon>
80
+ <uv-line direction="column" :hairline="false" length="16" margin="0 8px"></uv-line>
81
+ <uv-icon name="home" size="20"></uv-icon>
82
+ </view>
83
+ </template>
84
+ </uv-navbar>
85
+ </view>
86
+ </template>
87
+
88
+ <style scoped lang="scss">
89
+ @mixin flex($direction: row) {
90
+ /* #ifndef APP-NVUE */
91
+ display: flex;
92
+ /* #endif */
93
+ flex-direction: $direction;
94
+ }
95
+ .uv-nav-slot {
96
+ @include flex;
97
+ align-items: center;
98
+ justify-content: space-between;
99
+ border-width: 0.5px;
100
+ border-radius: 100px;
101
+ border-color: #dadbde;
102
+ padding: 3px 7px;
103
+ opacity: 0.8;
104
+ }
105
+ </style>
106
+ ```
107
+
108
+ ### 导航栏背景颜色 {#bg}
109
+
110
+ 通过 `bgColor` 支持普通颜色、透明度、渐变色或背景图片。
111
+
112
+ ```vue
113
+ <template>
114
+ <view>
115
+ <!-- 普通颜色 -->
116
+ <uv-navbar title="个人中心" bgColor="#c0c4cc"></uv-navbar>
117
+ <!-- 透明背景 -->
118
+ <uv-navbar title="个人中心" bg-color="rgba(0,0,0,.5)"></uv-navbar>
119
+ <!-- 渐变色 -->
120
+ <uv-navbar
121
+ title="个人中心"
122
+ bg-color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))"
123
+ ></uv-navbar>
124
+ <!-- 背景图片 -->
125
+ <uv-navbar
126
+ title="个人中心"
127
+ bg-color="https://via.placeholder.com/400x200.png/3c9cff/fff"
128
+ imgMode="aspectFit"
129
+ ></uv-navbar>
130
+ </view>
131
+ </template>
132
+ ``>
133
+
134
+ ## API {#api}
135
+
136
+ ### NavBar Props {#props}
137
+
138
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
139
+ | --- | --- | --- | --- | --- |
140
+ | title | 导航栏标题(为空字符时隐藏标题占位) | String | - | - |
141
+ | safeAreaInsetTop | 是否开启顶部安全区适配 | Boolean | true | true \| false |
142
+ | placeholder | 固定在顶部时是否生成等高占位元素防塌陷 | Boolean | false | true \| false |
143
+ | fixed | 是否固定在顶部 | Boolean | true | true \| false |
144
+ | border | 是否显示底部下边框 | Boolean | false | true \| false |
145
+ | leftIcon | 左侧返回图标(仅内置图标) | String | arrow-left | - |
146
+ | leftText | 左侧提示文字 | String | - | - |
147
+ | rightText | 右侧文字 | String | - | - |
148
+ | rightIcon | 右侧图标(仅内置图标) | String | - | - |
149
+ | bgColor | 背景设置(支持普通色、渐变、图片) | String | #ffffff | - |
150
+ | imgMode | 当 `bgColor` 为图片时的裁剪模式 | String | aspectFill | 参考 uni `image` |
151
+ | titleWidth | 标题最大宽度(超出省略号,px/rpx) | String \| Number | 400rpx | - |
152
+ | height | 导航栏高度(不含状态栏),内部会自动加上状态栏高度 | String \| Number | 44px | - |
153
+ | leftIconSize | 左侧图标大小 | String \| Number | 20px | - |
154
+ | leftIconColor | 左侧图标颜色 | String | #303133 | - |
155
+ | autoBack | 点击左侧区域时是否自动返回上一页 | Boolean | false | true \| false |
156
+ | titleStyle | 标题样式(对象或字符串) | String \| Object | - | - |
157
+
158
+ ### NavBar Events {#events}
159
+
160
+ | 事件名 | 说明 | 回调参数 |
161
+ | --- | --- | --- |
162
+ | @leftClick | 点击左侧区域 | - |
163
+ | @rightClick | 点击右侧区域 | - |
164
+
165
+ ### NavBar Slots {#slots}
166
+
167
+ | 名称 | 说明 |
168
+ | --- | --- |
169
+ | left | 自定义左侧区域内容 |
170
+ | right | 自定义右侧区域内容 |
171
+ | center | 自定义中部内容(可替代默认标题) |
@@ -0,0 +1,112 @@
1
+ ---
2
+ group: 反馈
3
+ category: Components
4
+ title: NoNetwork
5
+ subtitle: 无网络提示
6
+ description: 自动检测网络状态的全局遮罩组件,无需额外配置即可在断网时覆盖页面并提供重试入口。
7
+ demo:
8
+ cols: 2
9
+ ---
10
+
11
+ ## 何时使用 {#when-to-use}
12
+
13
+ `uv-no-network` 用于全局无网络提示场景:
14
+
15
+ - 断网时自动以 `fixed` 定位覆盖当前页面内容,恢复网络后自动隐藏
16
+ - App 端内置 5+ 接口,支持直接跳转系统设置,方便用户打开网络
17
+
18
+ 应用有网络时不会触发本组件。如需测试,请关闭手机的数据连接和 WiFi。
19
+ 由于普通组件无法覆盖原生组件,本组件不适用于包含 `video`、`map` 等原生组件的页面,可用 `cover-view` 自行实现。
20
+
21
+ > 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
22
+
23
+ ## 平台兼容性 {#platform}
24
+
25
+ | App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
26
+ | --- | --- | --- | --- | --- | --- |
27
+ | √ | √ | √ | √ | √ | √ |
28
+
29
+ **组件名:** `uv-no-network`
30
+
31
+ ## 代码演示 {#examples}
32
+
33
+ ### 基本使用 {#basic}
34
+
35
+ 无需额外配置,直接引入组件并监听断网/重试事件。
36
+
37
+ ```vue
38
+ <template>
39
+ <view>
40
+ <uv-no-network @disconnected="disconnected" @connected="connected" @retry="retry"></uv-no-network>
41
+ <!-- 下方是自己的业务代码 -->
42
+ <view class="uv-content">
43
+ <view class="uv-content__circle">
44
+ <uv-icon name="checkbox-mark" color="#fff" size="30"></uv-icon>
45
+ </view>
46
+ <text class="uv-content__normal">网络正常</text>
47
+ </view>
48
+ </view>
49
+ </template>
50
+
51
+ <script>
52
+ export default {
53
+ methods: {
54
+ disconnected() {
55
+ console.log('disconnected')
56
+ },
57
+ connected() {
58
+ console.log('connected')
59
+ },
60
+ retry() {
61
+ console.log('retry')
62
+ }
63
+ }
64
+ }
65
+ </script>
66
+
67
+ <style lang="scss" scoped>
68
+ @mixin flex($direction: row) {
69
+ /* #ifndef APP-NVUE */
70
+ display: flex;
71
+ /* #endif */
72
+ flex-direction: $direction;
73
+ }
74
+ .uv-content {
75
+ padding: 150px 60px 0;
76
+ @include flex(column);
77
+ align-items: center;
78
+ justify-content: center;
79
+ &__circle {
80
+ background-color: #5ac725;
81
+ @include flex;
82
+ border-radius: 100px;
83
+ width: 60px;
84
+ height: 60px;
85
+ align-items: center;
86
+ justify-content: center;
87
+ }
88
+ &__normal {
89
+ font-size: 30rpx;
90
+ color: #5ac725;
91
+ margin-top: 30rpx;
92
+ }
93
+ }
94
+ </style>
95
+ ```
96
+
97
+ ## API {#api}
98
+
99
+ ### NoNetwork Props {#props}
100
+
101
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
102
+ | --- | --- | --- | --- | --- |
103
+ | tips | 没有网络时的提示语 | String | 哎呀,网络信号丢失 | - |
104
+ | image | 无网络图片提示(src 或 base64) | String | - | - |
105
+
106
+ ### NoNetwork Events {#events}
107
+
108
+ | 事件名 | 说明 | 回调参数 |
109
+ | --- | --- | --- |
110
+ | @retry | 用户点击“重试”按钮时触发 | - |
111
+ | @connected | `retry` 后有网络时触发 | - |
112
+ | @disconnected | `retry` 后仍无网络时触发 | - |
@@ -0,0 +1,119 @@
1
+ ---
2
+ group: 导航
3
+ category: Components
4
+ title: NoticeBar
5
+ subtitle: 滚动通知
6
+ description: 用于滚动公告/通知展示,支持横向/竖向滚动、关闭、跳转与速度配置。
7
+ demo:
8
+ cols: 2
9
+ ---
10
+
11
+ ## 何时使用 {#when-to-use}
12
+
13
+ `uv-notice-bar` 常用于滚动公告等场景,支持多种模式与配置。
14
+
15
+ > 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
16
+
17
+ ## 平台兼容性 {#platform}
18
+
19
+ | App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
20
+ | --- | --- | --- | --- | --- | --- |
21
+ | √ | √ | √ | √ | √ | √ |
22
+
23
+ **组件名:** `uv-notice-bar`
24
+
25
+ ## 代码演示 {#examples}
26
+
27
+ ### 基本使用 {#basic}
28
+
29
+ 通过 `text` 设置需要滚动的内容。
30
+
31
+ ```vue
32
+ <template>
33
+ <view>
34
+ <uv-notice-bar :text="text"></uv-notice-bar>
35
+ </view>
36
+ </template>
37
+
38
+ <script>
39
+ export default {
40
+ data() {
41
+ return {
42
+ text: 'uv-ui众多组件覆盖开发过程的各个需求,组件功能丰富,多端兼容。让您快速集成,开箱即用'
43
+ }
44
+ }
45
+ }
46
+ </script>
47
+ ```
48
+
49
+ ### 竖向滚动 {#column}
50
+
51
+ 将 `direction` 设为 `column`(默认为 `row`)。注意:column 模式下 `text` 需为数组。
52
+
53
+ ```vue
54
+ <template>
55
+ <view>
56
+ <uv-notice-bar :text="text" direction="column"></uv-notice-bar>
57
+ </view>
58
+ </template>
59
+
60
+ <script>
61
+ export default {
62
+ data() {
63
+ return {
64
+ text: ['uv-ui众多组件覆盖开发过程的各个需求', '组件功能丰富,多端兼容', '让您快速集成,开箱即用']
65
+ }
66
+ }
67
+ }
68
+ </script>
69
+ ```
70
+
71
+ ### 可关闭 {#closable}
72
+
73
+ 通过 `mode="closable"` 显示右侧关闭按钮。
74
+
75
+ ```vue
76
+ <template>
77
+ <uv-notice-bar :text="text" mode="closable"></uv-notice-bar>
78
+ </template>
79
+ ```
80
+
81
+ ### 配置滚动速度与跳转 {#speed-url}
82
+
83
+ `speed` 配置横向滚动速度;`url` 配置跳转。
84
+
85
+ ```vue
86
+ <template>
87
+ <uv-notice-bar :text="text" mode="closable" speed="250" url="/pages/componentsB/tag/tag"></uv-notice-bar>
88
+ </template>
89
+ ```
90
+
91
+ ## API {#api}
92
+
93
+ ### NoticeBar Props {#props}
94
+
95
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
96
+ | --- | --- | --- | --- | --- |
97
+ | text | 显示内容(direction=column 需为数组;row 需为字符串) | Array \| String | - | - |
98
+ | direction | 滚动模式:row 横向 / column 竖向 | String | row | row \| column |
99
+ | step | direction=row 时是否步进滚动 | Boolean | false | true \| false |
100
+ | icon | 左侧音量图标(不显示可传 false 或空) | String | volume | - |
101
+ | mode | 通告模式:link 显示右箭头 / closable 显示关闭图标 | String | - | link \| closable |
102
+ | color | 文字颜色 | String | #f9ae3d | - |
103
+ | bgColor | 背景颜色 | String | #fdf6ec | - |
104
+ | speed | 水平滚动速度(每秒滚动 px/rpx) | String \| Number | 80 | - |
105
+ | fontSize | 字体大小 | String \| Number | 14 | - |
106
+ | duration | 滚动周期时长(ms) | String \| Number | 2000 | - |
107
+ | url | 跳转页面路径 | String | - | - |
108
+ | linkType | 页面跳转类型 | String | navigateTo | - |
109
+ | disableTouch | 是否禁止手动滑动切换(仅 column 生效) | Boolean | true | true \| false |
110
+ | disableScroll | 是否禁止自动滚动(仅 column 生效) | Boolean | false | true \| false |
111
+ | customStyle | 自定义外部样式 | Object | - | - |
112
+
113
+ ### NoticeBar Events {#events}
114
+
115
+ | 事件名 | 说明 | 回调参数 |
116
+ | --- | --- | --- |
117
+ | @click | 点击通告文字触发 | index:点击的 text 索引 |
118
+ | @close | 点击右侧关闭图标触发 | - |
119
+ | @change | direction=column 滚动时触发 | index:索引 |