@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,185 @@
1
+ ---
2
+ group: 基础
3
+ category: Components
4
+ title: Notify
5
+ subtitle: 消息提示
6
+ description: 页面顶部滑出提示条,支持主题方法调用、show 传参、插槽自定义图标与手动关闭。
7
+ demo:
8
+ cols: 2
9
+ ---
10
+
11
+ ## 何时使用 {#when-to-use}
12
+
13
+ `uv-notify` 一般用于页面顶部向下滑出一个提示,随后自动收起的场景。支持 ref 调用与主题快捷方法。
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-notify`
24
+
25
+ ## 代码演示 {#examples}
26
+
27
+ ### 基本使用 {#basic}
28
+
29
+ 使用 `ref` 调用组件 `show()` 方法显示,更多参数见 API。
30
+
31
+ ```vue
32
+ <template>
33
+ <uv-notify ref="notify" message="Hi uv-ui" type="success"></uv-notify>
34
+ </template>
35
+
36
+ <script>
37
+ export default {
38
+ onReady() {
39
+ this.$refs.notify.show()
40
+ }
41
+ }
42
+ </script>
43
+ ```
44
+
45
+ ### 主题方法调用 {#theme}
46
+
47
+ 组件内置主题方法:`primary / success / error / warning`,调用参数为提示文本。
48
+
49
+ ```vue
50
+ <template>
51
+ <uv-notify ref="notify"></uv-notify>
52
+ </template>
53
+
54
+ <script>
55
+ export default {
56
+ onReady() {
57
+ this.$refs.notify.primary('Primary主题')
58
+ }
59
+ }
60
+ </script>
61
+ ```
62
+
63
+ ### 自定义图标 {#icon-slot}
64
+
65
+ 通过插槽自定义图标。
66
+
67
+ ```vue
68
+ <template>
69
+ <uv-notify ref="notify" :duration="10 * 1000" type="error" message="HI uvui">
70
+ <template v-slot:icon>
71
+ <image src="https://via.placeholder.com/50x50.png/2878ff" style="width: 30rpx;height: 30rpx;" mode="aspectFit"></image>
72
+ </template>
73
+ </uv-notify>
74
+ </template>
75
+
76
+ <script>
77
+ export default {
78
+ onReady() {
79
+ this.$refs.notify.show()
80
+ }
81
+ }
82
+ </script>
83
+ ```
84
+
85
+ ### 使用 show 方法传参 {#show-params}
86
+
87
+ 也可直接在 `show` 中传入配置对象。
88
+
89
+ ```vue
90
+ <template>
91
+ <uv-notify ref="notify"></uv-notify>
92
+ </template>
93
+
94
+ <script>
95
+ export default {
96
+ onReady() {
97
+ this.$refs.notify.show({
98
+ top: 10,
99
+ type: 'error',
100
+ color: '#000',
101
+ bgColor: '#e8e8e8',
102
+ message: 'Hi uv-ui',
103
+ duration: 1000 * 3,
104
+ fontSize: '20rpx',
105
+ safeAreaInsetTop: true
106
+ })
107
+ }
108
+ }
109
+ </script>
110
+ ```
111
+
112
+ ### 手动关闭提示 {#close}
113
+
114
+ `duration` 控制显示时间,到时会自动关闭;也可调用 `close()` 手动关闭。
115
+
116
+ ```vue
117
+ <template>
118
+ <uv-notify ref="notify"></uv-notify>
119
+ </template>
120
+
121
+ <script>
122
+ export default {
123
+ onReady() {
124
+ this.$refs.notify.show({
125
+ top: 10,
126
+ type: 'error',
127
+ color: '#000',
128
+ bgColor: '#e8e8e8',
129
+ message: 'Hi uv-ui',
130
+ duration: 1000 * 3,
131
+ fontSize: '20rpx',
132
+ safeAreaInsetTop: true
133
+ })
134
+ setTimeout(() => {
135
+ this.$refs.notify.close()
136
+ }, 1000)
137
+ }
138
+ }
139
+ </script>
140
+ ```
141
+
142
+ ## API {#api}
143
+
144
+ ### Notify Props {#props}
145
+
146
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
147
+ | --- | --- | --- | --- | --- |
148
+ | top | 距顶部距离 | String \| Number | 0 | - |
149
+ | type | 主题 | String | primary | - |
150
+ | color | 字体颜色 | String | #ffffff | - |
151
+ | bgColor | 背景颜色 | String | - | - |
152
+ | message | 展示文字内容 | String | - | - |
153
+ | duration | 展示时长(0 时不消失,ms) | String \| Number | 3000 | - |
154
+ | fontSize | 字体大小(px/rpx) | String \| Number | 15 | - |
155
+ | safeAreaInsetTop | 是否留出顶部安全距离 | Boolean | false | true \| false |
156
+ | customStyle | 自定义外部样式 | Object | - | - |
157
+
158
+ ### Show Methods Params {#show-method-params}
159
+
160
+ 与上面的 Notify Props 作用一致(通过 `show({ ... })` 传入)。
161
+
162
+ | 参数 | 说明 | 类型 | 默认值 |
163
+ | --- | --- | --- | --- |
164
+ | top | 距顶部距离 | String \| Number | 0 |
165
+ | type | 主题 | String | primary |
166
+ | color | 字体颜色 | String | #ffffff |
167
+ | bgColor | 背景颜色 | String | - |
168
+ | message | 展示文字内容 | String | - |
169
+ | duration | 展示时长(ms) | String \| Number | 3000 |
170
+ | fontSize | 字体大小(px/rpx) | String \| Number | 15 |
171
+ | safeAreaInsetTop | 是否留出顶部安全距离 | Boolean | false |
172
+
173
+ ### Notify Methods {#methods}
174
+
175
+ | 方法名 | 说明 |
176
+ | --- | --- |
177
+ | show | 显示并加载配置 |
178
+ | primary / success / warning / error | 显示对应主题提示 |
179
+ | close | 关闭提示 |
180
+
181
+ ### Notify Slots {#slots}
182
+
183
+ | 名称 | 说明 |
184
+ | --- | --- |
185
+ | icon | 自定义图标 |
@@ -0,0 +1,131 @@
1
+ ---
2
+ group: 表单
3
+ category: Components
4
+ title: NumberBox
5
+ subtitle: 步进器
6
+ description: 用于商城选择商品数量等,只能输入大于等于 0 的整数。
7
+ demo:
8
+ cols: 2
9
+ ---
10
+
11
+ ## 何时使用 {#when-to-use}
12
+
13
+ `uv-number-box` 通过 `v-model` 双向绑定,`v-model` 会自动更新,无需在 change 中再赋值。
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-number-box`
24
+
25
+ ## 代码演示 {#examples}
26
+
27
+ ### 基本使用 {#basic}
28
+
29
+ ```vue
30
+ <template>
31
+ <uv-number-box v-model="value" @change="valChange"></uv-number-box>
32
+ </template>
33
+ <script>
34
+ export default {
35
+ data() {
36
+ return { value: 0 }
37
+ },
38
+ methods: {
39
+ valChange(e) {
40
+ console.log('当前值为: ' + e.value)
41
+ }
42
+ }
43
+ }
44
+ </script>
45
+ ```
46
+
47
+ ### 步长 {#step}
48
+
49
+ ```vue
50
+ <uv-number-box :step="2"></uv-number-box>
51
+ ```
52
+
53
+ ### 范围限制 {#min-max}
54
+
55
+ ```vue
56
+ <uv-number-box :min="1" :max="100"></uv-number-box>
57
+ ```
58
+
59
+ ### 固定小数位 {#decimal}
60
+
61
+ ```vue
62
+ <uv-number-box step="0.25" decimal-length="1"></uv-number-box>
63
+ ```
64
+
65
+ ### 禁用 {#disabled}
66
+
67
+ ```vue
68
+ <uv-number-box :disabled="true"></uv-number-box>
69
+ <uv-number-box :disabledInput="true"></uv-number-box>
70
+ <uv-number-box :disablePlus="true"></uv-number-box>
71
+ <uv-number-box :disableMinus="true"></uv-number-box>
72
+ <uv-number-box :longPress="false"></uv-number-box>
73
+ ```
74
+
75
+ ### 异步变更 {#async}
76
+
77
+ `asyncChange` 为 true 时需手动控制 value。
78
+
79
+ ```vue
80
+ <uv-number-box v-model="value" :asyncChange="true" @change="onChange"></uv-number-box>
81
+ ```
82
+
83
+ ### 自定义 slot {#slot}
84
+
85
+ ```vue
86
+ <uv-number-box v-model="value">
87
+ <template v-slot:minus>...</template>
88
+ <template v-slot:input>...</template>
89
+ <template v-slot:plus>...</template>
90
+ </uv-number-box>
91
+ ```
92
+
93
+ ## API {#api}
94
+
95
+ ### NumberBox Props {#props}
96
+
97
+ | 参数 | 说明 | 类型 | 默认值 |
98
+ | --- | --- | --- | --- |
99
+ | value / v-model | 绑定值 | String \| Number | 1 |
100
+ | name | 标识符 | String \| Number | - |
101
+ | min | 最小值 | String \| Number | 1 |
102
+ | max | 最大值 | String \| Number | - |
103
+ | step | 步长 | String \| Number | 1 |
104
+ | integer | 仅正整数 | Boolean | false |
105
+ | disabled | 禁用 | Boolean | false |
106
+ | disabledInput | 禁止输入框 | Boolean | false |
107
+ | asyncChange | 异步变更 | Boolean | false |
108
+ | inputWidth | 输入框宽度 px | String \| Number | 35 |
109
+ | showMinus | 显示减少按钮 | Boolean | true |
110
+ | showPlus | 显示增加按钮 | Boolean | true |
111
+ | decimalLength | 小数位数 | String \| Number | - |
112
+ | longPress | 允许长按 | Boolean | true |
113
+ | disablePlus | 禁用增加 | Boolean | false |
114
+ | disableMinus | 禁用减少 | Boolean | false |
115
+
116
+ ### NumberBox Events {#events}
117
+
118
+ | 事件名 | 说明 | 回调参数 |
119
+ | --- | --- | --- |
120
+ | @focus | 获得焦点 | { value, name } |
121
+ | @blur | 失去焦点 | { value, name } |
122
+ | @change | 内容变化 | { value, name } |
123
+ | @overlimit | 超出范围 | type: minus \| plus |
124
+
125
+ ### NumberBox Slots {#slots}
126
+
127
+ | 名称 | 说明 |
128
+ | --- | --- |
129
+ | minus | 减少按钮 |
130
+ | input | 输入框 |
131
+ | plus | 增加按钮 |
@@ -0,0 +1,122 @@
1
+ ---
2
+ group: 反馈
3
+ category: Components
4
+ title: Overlay
5
+ subtitle: 遮罩层
6
+ description: 在弹窗等场景下使用的背景遮罩层组件,用于阻止底层页面操作并突出前景内容。
7
+ demo:
8
+ cols: 2
9
+ ---
10
+
11
+ ## 何时使用 {#when-to-use}
12
+
13
+ `uv-overlay` 用于创建全屏遮罩层,常见于:
14
+
15
+ - 弹窗(如 `uv-popup`、`uv-toast`、`uv-tooltip` 等)背景
16
+ - 高亮某个区域并屏蔽其他区域点击
17
+
18
+ 通过控制 `show` 显示与否,配合 `@click` 处理遮罩点击行为。
19
+
20
+ > 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
21
+
22
+ ## 平台兼容性 {#platform}
23
+
24
+ | App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
25
+ | --- | --- | --- | --- | --- | --- |
26
+ | √ | √ | √ | √ | √ | √ |
27
+
28
+ **组件名:** `uv-overlay`
29
+
30
+ ## 代码演示 {#examples}
31
+
32
+ ### 基本使用 {#basic}
33
+
34
+ 通过 `show` 控制遮罩显示,默认点击遮罩时会触发 `@click` 事件。
35
+
36
+ ```vue
37
+ <template>
38
+ <uv-overlay :show="show" @click="show = false"></uv-overlay>
39
+ </template>
40
+
41
+ <script>
42
+ export default {
43
+ data() {
44
+ return {
45
+ show: true
46
+ }
47
+ }
48
+ }
49
+ </script>
50
+ ```
51
+
52
+ ### 嵌入内容与阻止冒泡 {#slot}
53
+
54
+ 通过默认插槽在遮罩上方嵌入任意内容,如弹窗卡片。
55
+ 若不希望子内容点击冒泡到遮罩,请使用 `@tap.stop`。
56
+
57
+ ```vue
58
+ <template>
59
+ <uv-overlay :show="show" @click="show = false">
60
+ <view class="warp">
61
+ <view class="rect" @tap.stop></view>
62
+ </view>
63
+ </uv-overlay>
64
+ </template>
65
+
66
+ <script>
67
+ export default {
68
+ data() {
69
+ return {
70
+ show: true
71
+ }
72
+ }
73
+ }
74
+ </script>
75
+
76
+ <style scoped>
77
+ .warp {
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: center;
81
+ height: 100%;
82
+ }
83
+
84
+ .rect {
85
+ width: 120px;
86
+ height: 120px;
87
+ background-color: #fff;
88
+ }
89
+ </style>
90
+ ```
91
+
92
+ ### 遮罩样式 {#style}
93
+
94
+ 可通过 `duration`、`zIndex`、`opacity` 等属性控制动画时长、层级和透明度。
95
+
96
+ ```vue
97
+ <uv-overlay :show="true" :duration="400" :z-index="999" :opacity="0.3"></uv-overlay>
98
+ ```
99
+
100
+ ## API {#api}
101
+
102
+ ### Overlay Props {#props}
103
+
104
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
105
+ | --- | --- | --- | --- | --- |
106
+ | show | 是否显示遮罩 | Boolean | false | true \| false |
107
+ | zIndex | 遮罩层级 | String \| Number | 10070 | - |
108
+ | duration | 淡入淡出动画时长(ms) | String \| Number | 300 | - |
109
+ | opacity | 不透明度(作为 rgba 第四个参数) | String \| Number | 0.5 | - |
110
+
111
+ ### Overlay Events {#events}
112
+
113
+ | 事件名 | 说明 | 回调参数 |
114
+ | --- | --- | --- |
115
+ | @click | 点击遮罩时触发 | - |
116
+
117
+ ### Overlay Slots {#slots}
118
+
119
+ | 名称 | 说明 |
120
+ | --- | --- |
121
+ | default | 默认插槽,用于在遮罩层上方嵌入内容 |
122
+
@@ -0,0 +1,177 @@
1
+ ---
2
+ group: 数据
3
+ category: Components
4
+ title: Parse
5
+ subtitle: 富文本解析器
6
+ description: 将 HTML 字符串解析为可展示的富文本内容,适用于文章内容、商品详情等复杂富文本场景。
7
+ demo:
8
+ cols: 2
9
+ ---
10
+
11
+ ## 何时使用 {#when-to-use}
12
+
13
+ `uv-parse` 适用于 **富文本解析展示** 的场景,例如:
14
+
15
+ - 文章详情、图文资讯
16
+ - 商品详情描述
17
+ - 含原生 HTML 标签的字符串展示
18
+
19
+ 与官方 `rich-text` 对比:
20
+
21
+ - 简单、轻量字符串:推荐使用 `rich-text`,性能更好
22
+ - 复杂内容(多图片、多标签、自定义样式)场景:推荐使用 `uv-parse`
23
+
24
+ > 组件基于优秀开源项目 mp-html 封装,仅对重要能力做简化说明,更多细节可参考 mp-html 官方文档。
25
+ > 若为 npm 安装 + app-nvue(其他端可忽略),需在 `static` 目录手动复制 `uv-parse` 相关静态资源。
26
+ > 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
27
+
28
+ ## 平台兼容性 {#platform}
29
+
30
+ | App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
31
+ | --- | --- | --- | --- | --- | --- |
32
+ | √ | √ | √ | √ | √ | √ |
33
+
34
+ **组件名:** `uv-parse`
35
+
36
+ ## 代码演示 {#examples}
37
+
38
+ ### 基本使用 {#basic}
39
+
40
+ 通过 `content` 传入需要解析的 HTML 字符串。
41
+
42
+ ```vue
43
+ <template>
44
+ <view class="uv-content">
45
+ <uv-parse :content="content"></uv-parse>
46
+ </view>
47
+ </template>
48
+
49
+ <script>
50
+ export default {
51
+ data() {
52
+ return {
53
+ content: `
54
+ <p>露从今夜白,月是故乡明</p>
55
+ <img src="https://cdn.uviewui.com/uview/swiper/2.jpg" />
56
+ `
57
+ }
58
+ }
59
+ }
60
+ </script>
61
+
62
+ <style lang="scss" scoped>
63
+ .uv-content {
64
+ padding: 24rpx;
65
+ }
66
+ </style>
67
+ ```
68
+
69
+ ### 长按复制 {#selectable}
70
+
71
+ 通过 `selectable` 开启长按复制。
72
+
73
+ ```vue
74
+ <uv-parse :content="content" :selectable="true"></uv-parse>
75
+ ```
76
+
77
+ ### 标签级样式定制(tagStyle) {#tag-style}
78
+
79
+ 通过 `tagStyle` 对特定标签设置样式(字符串形式)。
80
+
81
+ ```vue
82
+ <template>
83
+ <view class="uv-content">
84
+ <uv-parse :content="content" :tagStyle="style"></uv-parse>
85
+ </view>
86
+ </template>
87
+
88
+ <script>
89
+ export default {
90
+ data() {
91
+ return {
92
+ content: `
93
+ <p>露从今夜白,月是故乡明</p>
94
+ <img src="https://cdn.uviewui.com/uview/swiper/2.jpg" />
95
+ `,
96
+ style: {
97
+ p: 'color: red;font-size:32rpx',
98
+ span: 'font-size: 30rpx'
99
+ }
100
+ }
101
+ }
102
+ }
103
+ </script>
104
+ ```
105
+
106
+ ### 父元素统一样式 {#wrapper-style}
107
+
108
+ 通过父容器的样式统一设置字体大小、颜色、行高等。
109
+
110
+ ```vue
111
+ <template>
112
+ <view class="uv-content">
113
+ <uv-parse :content="content"></uv-parse>
114
+ </view>
115
+ </template>
116
+
117
+ <style lang="scss" scoped>
118
+ .uv-content {
119
+ padding: 24rpx;
120
+ font-size: 32rpx;
121
+ color: $uv-content-color;
122
+ line-height: 1.6;
123
+ }
124
+ </style>
125
+ ```
126
+
127
+ ### 懒加载与占位图 {#lazy-load}
128
+
129
+ ```vue
130
+ <uv-parse :content="content" :lazyLoad="true" :loadingImg="loadingImg"></uv-parse>
131
+ ```
132
+
133
+ ### 链接跳转与锚点 {#anchor}
134
+
135
+ - H5 / App(含 nvue):外链可直接打开
136
+ - 小程序:外链自动复制;`app-id` 可跳转到其他小程序
137
+
138
+ ```html
139
+ <a href="#">跳转到顶部</a>
140
+ <a href="#list">跳转到列表</a>
141
+ <a href="https://www.uvui.cn">外部链接</a>
142
+ <a href="/pages/demo/demo">内部链接</a>
143
+ ```
144
+
145
+ ## API {#api}
146
+
147
+ ### Parse Props {#props}
148
+
149
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
150
+ | --- | --- | --- | --- | --- |
151
+ | container-style | 外层容器样式 | String | - | - |
152
+ | content | 用于渲染的 HTML 字符串 | String | - | - |
153
+ | copy-link | 是否允许外部链接被点击时自动复制 | Boolean | true | true \| false |
154
+ | domain | 主域名(用于补全相对链接) | String | - | - |
155
+ | error-img | 图片加载错误时的占位图 | String | - | - |
156
+ | lazy-load | 是否开启图片懒加载 | Boolean | false | true \| false |
157
+ | loading-img | 图片加载过程中的占位图 | String | - | - |
158
+ | pause-video | 播放一个视频时是否自动暂停其他视频 | Boolean | true | true \| false |
159
+ | preview-img | 是否开启图片点击自动预览 | Boolean | true | true \| false |
160
+ | scroll-table | 是否为每个表格添加横向滚动层 | Boolean | false | true \| false |
161
+ | selectable | 是否开启长按复制内容 | Boolean | false | true |
162
+ | set-title | 是否将 `<title>` 内容设置为页面标题 | Boolean | true | true \| false |
163
+ | show-img-menu | 是否允许图片长按时显示菜单 | Boolean | true | true \| false |
164
+ | tag-style | 设置标签默认样式 | Object | - | - |
165
+ | use-anchor | 是否启用锚点链接 | Boolean | false | true \| false |
166
+
167
+ ### Parse Events {#events}
168
+
169
+ | 事件名 | 说明 | 回调参数 |
170
+ | --- | --- | --- |
171
+ | @load | DOM 树加载完成时触发(所有节点添加到节点树后,可调用相关 API) | - |
172
+ | @ready | 渲染完成时触发,返回 `boundingClientRect` 查询结果(包含宽高、位置信息),图片较多时可能延时较长 | rect 信息 |
173
+ | @error | 解析/渲染出错时触发 | `object`:`source` 错误来源,`errMsg` 错误信息,`target` 出错标签信息 |
174
+ | @imgtap | 图片被点击时触发 | `object`:`src` 图片链接,`ignore="1"` 时可在事件中阻止预览 |
175
+ | @linktap | 链接被点击时触发 | `object`:包含被点击 `a` 标签的全部属性 |
176
+ | @play | 音视频播放时触发 | - |
177
+