@fox-js/phone-skills 4.0.1-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.
- package/README.md +30 -0
- package/foxui/SKILL.md +442 -0
- package/foxui/references/fox-action-sheet/doc.md +74 -0
- package/foxui/references/fox-actionsheet-item/doc.md +499 -0
- package/foxui/references/fox-animate/doc.md +66 -0
- package/foxui/references/fox-audio/doc.md +76 -0
- package/foxui/references/fox-avatar/doc.md +70 -0
- package/foxui/references/fox-back-top/doc.md +69 -0
- package/foxui/references/fox-badge/doc.md +72 -0
- package/foxui/references/fox-barrage/doc.md +116 -0
- package/foxui/references/fox-button/doc.md +203 -0
- package/foxui/references/fox-calendar/doc.md +346 -0
- package/foxui/references/fox-calendar-item/doc.md +331 -0
- package/foxui/references/fox-cascader/doc.md +78 -0
- package/foxui/references/fox-cascader-item/doc.md +710 -0
- package/foxui/references/fox-cell/doc.md +74 -0
- package/foxui/references/fox-checkbox-item/doc.md +387 -0
- package/foxui/references/fox-circle-progress/doc.md +65 -0
- package/foxui/references/fox-collapse/doc.md +71 -0
- package/foxui/references/fox-count-down/doc.md +78 -0
- package/foxui/references/fox-count-up/doc.md +178 -0
- package/foxui/references/fox-date-item/doc.md +437 -0
- package/foxui/references/fox-date-picker/doc.md +438 -0
- package/foxui/references/fox-dialog/doc.md +242 -0
- package/foxui/references/fox-divider/doc.md +149 -0
- package/foxui/references/fox-domain-provider/doc.md +93 -0
- package/foxui/references/fox-drag/doc.md +64 -0
- package/foxui/references/fox-dropdown/doc.md +138 -0
- package/foxui/references/fox-elevator/doc.md +66 -0
- package/foxui/references/fox-ellipsis/doc.md +69 -0
- package/foxui/references/fox-empty/doc.md +67 -0
- package/foxui/references/fox-fixed-nav/doc.md +72 -0
- package/foxui/references/fox-floating-button/doc.md +142 -0
- package/foxui/references/fox-grid/doc.md +69 -0
- package/foxui/references/fox-group/doc.md +295 -0
- package/foxui/references/fox-icon/doc.md +65 -0
- package/foxui/references/fox-image/doc.md +75 -0
- package/foxui/references/fox-image-preview/doc.md +79 -0
- package/foxui/references/fox-indicator/doc.md +70 -0
- package/foxui/references/fox-infinite-loading/doc.md +74 -0
- package/foxui/references/fox-input-item/doc.md +210 -0
- package/foxui/references/fox-input-number/doc.md +199 -0
- package/foxui/references/fox-input-number-item/doc.md +213 -0
- package/foxui/references/fox-item/doc.md +207 -0
- package/foxui/references/fox-layout/doc.md +273 -0
- package/foxui/references/fox-link-item/doc.md +158 -0
- package/foxui/references/fox-list/doc.md +71 -0
- package/foxui/references/fox-mapping/doc.md +251 -0
- package/foxui/references/fox-menu/doc.md +425 -0
- package/foxui/references/fox-message-box/doc.md +200 -0
- package/foxui/references/fox-money-item/doc.md +174 -0
- package/foxui/references/fox-more-button/doc.md +208 -0
- package/foxui/references/fox-navbar/doc.md +75 -0
- package/foxui/references/fox-notice-bar/doc.md +71 -0
- package/foxui/references/fox-notify/doc.md +72 -0
- package/foxui/references/fox-number-keyboard/doc.md +77 -0
- package/foxui/references/fox-over-lay/doc.md +70 -0
- package/foxui/references/fox-page/doc.md +76 -0
- package/foxui/references/fox-pagination/doc.md +73 -0
- package/foxui/references/fox-picker/doc.md +668 -0
- package/foxui/references/fox-picker-item/doc.md +389 -0
- package/foxui/references/fox-popover/doc.md +70 -0
- package/foxui/references/fox-popover-dialog/doc.md +113 -0
- package/foxui/references/fox-popup/doc.md +88 -0
- package/foxui/references/fox-price/doc.md +67 -0
- package/foxui/references/fox-progress/doc.md +74 -0
- package/foxui/references/fox-pull-refresh/doc.md +77 -0
- package/foxui/references/fox-radio-item/doc.md +384 -0
- package/foxui/references/fox-range/doc.md +65 -0
- package/foxui/references/fox-rate/doc.md +141 -0
- package/foxui/references/fox-rate-item/doc.md +137 -0
- package/foxui/references/fox-rolling-provider/doc.md +87 -0
- package/foxui/references/fox-search-bar/doc.md +91 -0
- package/foxui/references/fox-short-password/doc.md +78 -0
- package/foxui/references/fox-side-nav-bar/doc.md +68 -0
- package/foxui/references/fox-signature/doc.md +202 -0
- package/foxui/references/fox-skeleton/doc.md +73 -0
- package/foxui/references/fox-steps/doc.md +162 -0
- package/foxui/references/fox-steps-bar/doc.md +610 -0
- package/foxui/references/fox-sticky/doc.md +68 -0
- package/foxui/references/fox-swipe/doc.md +176 -0
- package/foxui/references/fox-swiper/doc.md +254 -0
- package/foxui/references/fox-switch/doc.md +162 -0
- package/foxui/references/fox-switch-item/doc.md +190 -0
- package/foxui/references/fox-tabbar/doc.md +63 -0
- package/foxui/references/fox-table/doc.md +640 -0
- package/foxui/references/fox-tabs/doc.md +67 -0
- package/foxui/references/fox-tabs-bar/doc.md +533 -0
- package/foxui/references/fox-tag/doc.md +213 -0
- package/foxui/references/fox-text/doc.md +84 -0
- package/foxui/references/fox-textarea-item/doc.md +106 -0
- package/foxui/references/fox-toast/doc.md +149 -0
- package/foxui/references/fox-tour/doc.md +89 -0
- package/foxui/references/fox-trend-arrow/doc.md +72 -0
- package/foxui/references/fox-uploader/doc.md +96 -0
- package/foxui/references/fox-video/doc.md +245 -0
- package/foxui/references/fox-water-mark/doc.md +81 -0
- package/package.json +21 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 江成
|
|
3
|
+
* @Date: 2026-04-27 00:37:28
|
|
4
|
+
* @LastEditors: 江成
|
|
5
|
+
* @LastEditTime: 2026-05-12 22:33:21
|
|
6
|
+
-->
|
|
7
|
+
---
|
|
8
|
+
title: Mapping 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 映射组件
|
|
12
|
+
tags: [foxui, fox-mapping, FoxMapping]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-group","fox-item"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Mapping 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Mapping 是 foxui 中用于 **映射组件** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-mapping` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、支持 v-model 双向绑定、支持插槽扩展自定义内容
|
|
24
|
+
- **适用场景**: 映射组件
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 映射组件 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `modelValue` | value/v-model | String/Boolean/Number | - |
|
|
37
|
+
| `source` | 映射数据源 | String/Function/Array | - |
|
|
38
|
+
| `source-type` | 映射数据源类型 | String | mapping |
|
|
39
|
+
| `params` | 参数配合api数据源 | String | - |
|
|
40
|
+
| `text-key` | 数据源text键名 | String | text |
|
|
41
|
+
| `value-key` | 数据源value键名 | String | value |
|
|
42
|
+
| `children-key` | 数据源children键名 | String | children |
|
|
43
|
+
| `tag` | 组件对应的标签 | String/Component | span |
|
|
44
|
+
| `separator` | 多列数据使用的分割符 | String | - |
|
|
45
|
+
| `empty-text` | 匹配不到时,显示的默认text | String | - |
|
|
46
|
+
|
|
47
|
+
### 2.2 Events 事件
|
|
48
|
+
|
|
49
|
+
| 事件名 | 类型 | 说明 |
|
|
50
|
+
| :--- | :--- | :--- |
|
|
51
|
+
无
|
|
52
|
+
|
|
53
|
+
### 2.3 Methods 方法
|
|
54
|
+
|
|
55
|
+
| 方法名 | 参数 | 说明 |
|
|
56
|
+
| :--- | :--- | :--- |
|
|
57
|
+
无
|
|
58
|
+
|
|
59
|
+
### 2.4 Slots 插槽
|
|
60
|
+
|
|
61
|
+
| 插槽名 | 说明 |
|
|
62
|
+
| :--- | :--- |
|
|
63
|
+
| `default` | 内容 |
|
|
64
|
+
|
|
65
|
+
## 3. 例子 (Examples)
|
|
66
|
+
|
|
67
|
+
## 代码演示
|
|
68
|
+
|
|
69
|
+
### 基础用法+数组数据源
|
|
70
|
+
设置`value`和`source`属性,组件把`value`值映射成`text`显示出来
|
|
71
|
+
```html
|
|
72
|
+
<script lang="ts" setup>
|
|
73
|
+
import { ref } from 'vue'
|
|
74
|
+
const source =[{text:'男', value:'01'}, {text:'女', value:"02"}]
|
|
75
|
+
const value = ref('01')
|
|
76
|
+
</script>
|
|
77
|
+
<template>
|
|
78
|
+
<fox-group column="2">
|
|
79
|
+
<fox-item>
|
|
80
|
+
<fox-mapping class="my-text" v-model="value" :source="source"></fox-mapping>
|
|
81
|
+
</fox-item>
|
|
82
|
+
</fox-group>
|
|
83
|
+
</template>
|
|
84
|
+
<style lang="scss" scoped>
|
|
85
|
+
.my-text{
|
|
86
|
+
color: #F00;
|
|
87
|
+
font-size: 20px;
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
90
|
+
```
|
|
91
|
+
### 多列数据+函数数据源
|
|
92
|
+
`source`为多列数据源,并通过`separator`设置了分割符
|
|
93
|
+
```html
|
|
94
|
+
<script lang="ts" setup>
|
|
95
|
+
import { ref } from 'vue'
|
|
96
|
+
const sourceForFunction = async function(){
|
|
97
|
+
let startYear = 2010
|
|
98
|
+
const yearItems = []
|
|
99
|
+
for(let i=0; i<12; i++){
|
|
100
|
+
const cur = startYear+i
|
|
101
|
+
yearItems.push({
|
|
102
|
+
text:`${cur}年`, value:`${cur}`
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
let monthItems = []
|
|
106
|
+
for(let i=1; i<=12; i++){
|
|
107
|
+
let s = `${i}`
|
|
108
|
+
if(s.length ==1){
|
|
109
|
+
s = `0${s}`
|
|
110
|
+
}
|
|
111
|
+
monthItems.push({
|
|
112
|
+
text:`${s}月`, value:`${i}`
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
return [yearItems, monthItems]
|
|
116
|
+
}
|
|
117
|
+
const value = ref(['2021','5'])
|
|
118
|
+
</script>
|
|
119
|
+
<template>
|
|
120
|
+
<fox-group column="2">
|
|
121
|
+
<fox-item>
|
|
122
|
+
<fox-mapping class="my-text" v-model="value" :source="sourceForFunction" separator="-"></fox-mapping>
|
|
123
|
+
</fox-item>
|
|
124
|
+
</fox-group>
|
|
125
|
+
</template>
|
|
126
|
+
<style lang="scss" scoped>
|
|
127
|
+
.my-text{
|
|
128
|
+
color: #F00;
|
|
129
|
+
font-size: 20px;
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
132
|
+
```
|
|
133
|
+
### 级联数据+API数据源
|
|
134
|
+
```html
|
|
135
|
+
<script lang="ts" setup>
|
|
136
|
+
import { ref, onMounted, onUnmounted } from 'vue'
|
|
137
|
+
import { setAPI } from '@/api'
|
|
138
|
+
//模拟测试,设置一个临时的API数据源,实际环境应该访问服务获取
|
|
139
|
+
setAPI('mapping', async function(){
|
|
140
|
+
return [
|
|
141
|
+
{
|
|
142
|
+
text: '浙江',
|
|
143
|
+
value: '01',
|
|
144
|
+
children: [
|
|
145
|
+
{
|
|
146
|
+
text: '杭州',
|
|
147
|
+
value: '0101',
|
|
148
|
+
children: [
|
|
149
|
+
{ text: '西湖区', value: '010101' },
|
|
150
|
+
{ text: '余杭区', value: '010102' }
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
text: '温州',
|
|
155
|
+
value: '0102',
|
|
156
|
+
children: [
|
|
157
|
+
{ text: '鹿城区', value: '010201' },
|
|
158
|
+
{ text: '瓯海区', value: '010201' }
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
text: '福建',
|
|
165
|
+
value: '02',
|
|
166
|
+
children: [
|
|
167
|
+
{
|
|
168
|
+
text: '福州',
|
|
169
|
+
value: '0201',
|
|
170
|
+
children: [
|
|
171
|
+
{ text: '鼓楼区', value: '020101' },
|
|
172
|
+
{ text: '台江区', value: '020102' }
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
text: '厦门',
|
|
177
|
+
value: '0202',
|
|
178
|
+
children: [
|
|
179
|
+
{ text: '思明区', value: '020201' },
|
|
180
|
+
{ text: '海沧区', value: '020201' }
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
})
|
|
187
|
+
const value = ref(['01','0101','010101'])
|
|
188
|
+
const value2 = ref<string[]>([])
|
|
189
|
+
let timer:any = null
|
|
190
|
+
onMounted(()=>{
|
|
191
|
+
let list = [['02','0201','020101'],['02','0202','020201']]
|
|
192
|
+
let i = 0
|
|
193
|
+
timer = setInterval(()=>{
|
|
194
|
+
let index = (i++)%list.length
|
|
195
|
+
value2.value = list[index]
|
|
196
|
+
},3000)
|
|
197
|
+
})
|
|
198
|
+
onUnmounted(()=>{
|
|
199
|
+
clearInterval(timer)
|
|
200
|
+
})
|
|
201
|
+
</script>
|
|
202
|
+
<template>
|
|
203
|
+
<fox-group column="2">
|
|
204
|
+
<fox-item>
|
|
205
|
+
<fox-mapping class="my-text" v-model="value" source="/api/city" ></fox-mapping>
|
|
206
|
+
</fox-item>
|
|
207
|
+
<fox-item>
|
|
208
|
+
<fox-mapping class="my-text2" v-model="value2" source="/api/city"></fox-mapping>
|
|
209
|
+
</fox-item>
|
|
210
|
+
</fox-group>
|
|
211
|
+
</template>
|
|
212
|
+
<style lang="scss" scoped>
|
|
213
|
+
.my-text{
|
|
214
|
+
color: #F00;
|
|
215
|
+
font-size: 20px;
|
|
216
|
+
}
|
|
217
|
+
.my-text2{
|
|
218
|
+
color: #00F;
|
|
219
|
+
font-size: 20px;
|
|
220
|
+
}
|
|
221
|
+
</style>
|
|
222
|
+
```
|
|
223
|
+
### 自定义插槽
|
|
224
|
+
使用自定义插槽,对显示内容进行扩展
|
|
225
|
+
```html
|
|
226
|
+
<script lang="ts" setup>
|
|
227
|
+
import { ref } from 'vue'
|
|
228
|
+
const source = [
|
|
229
|
+
{ text: '男', value: '01' },
|
|
230
|
+
{ text: '女', value: '02' }
|
|
231
|
+
]
|
|
232
|
+
const value = ref('01')
|
|
233
|
+
</script>
|
|
234
|
+
<template>
|
|
235
|
+
<fox-group column="2">
|
|
236
|
+
<fox-item>
|
|
237
|
+
<fox-mapping v-model="value" :source="source">
|
|
238
|
+
<template v-slot:default="scope">
|
|
239
|
+
<span>{{ scope.value }}-{{ scope.text }}</span>
|
|
240
|
+
</template>
|
|
241
|
+
</fox-mapping>
|
|
242
|
+
</fox-item>
|
|
243
|
+
</fox-group>
|
|
244
|
+
</template>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## 4. 相关组件 (Related Components)
|
|
248
|
+
- **fox-js**: 与 Mapping 配合使用的相关组件
|
|
249
|
+
- **fox-group**: 与 Mapping 配合使用的相关组件
|
|
250
|
+
- **fox-item**: 与 Mapping 配合使用的相关组件
|
|
251
|
+
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 江成
|
|
3
|
+
* @Date: 2026-04-27 00:37:28
|
|
4
|
+
* @LastEditors: 江成
|
|
5
|
+
* @LastEditTime: 2026-05-12 22:33:21
|
|
6
|
+
-->
|
|
7
|
+
---
|
|
8
|
+
title: Menu 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 下拉菜单组件
|
|
12
|
+
tags: [foxui, fox-menu, FoxMenu]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-menu-item","fox-button"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Menu 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Menu 是 foxui 中用于 **下拉菜单组件** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-menu` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、支持 v-model 双向绑定、支持禁用/只读状态、适配 H5 与小程序多端、支持主题定制
|
|
24
|
+
- **适用场景**: 下拉菜单组件
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 下拉菜单组件 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `title` | 菜单项标题 | String | 当前选中项文字 |
|
|
37
|
+
| `options` | 选项数组 | Array | - |
|
|
38
|
+
| `disabled` | 是否禁用菜单 | Boolean | false |
|
|
39
|
+
| `cols` | 可以设置一行展示多少列 options | Number | 1 |
|
|
40
|
+
| `title-icon` | 自定义标题图标 | String | - |
|
|
41
|
+
| `option-icon` | 自定义选项图标 | String | 'Check' |
|
|
42
|
+
| `direction` | 菜单展开方向,可选值为up | String | 'down' |
|
|
43
|
+
| `activeTitleClass` | 选项选中时自定义标题样式类 | String | - |
|
|
44
|
+
| `inactiveTitleClass` | 选项非选中时自定义标题样式类 | String | - |
|
|
45
|
+
|
|
46
|
+
### 2.2 Events 事件
|
|
47
|
+
|
|
48
|
+
| 事件名 | 类型 | 说明 |
|
|
49
|
+
| :--- | :--- | :--- |
|
|
50
|
+
| `change` | 选择 option 之后触发 | 选择的 value |
|
|
51
|
+
| `toggle` | 切换菜单展示状态,传 true 为显示,false 为隐藏,不传参为取反 | show?: boolean |
|
|
52
|
+
| `open` | 打开菜单栏时触发 | - |
|
|
53
|
+
| `close` | 关闭菜单栏时触发 | - |
|
|
54
|
+
|
|
55
|
+
### 2.3 Methods 方法
|
|
56
|
+
|
|
57
|
+
| 方法名 | 参数 | 说明 |
|
|
58
|
+
| :--- | :--- | :--- |
|
|
59
|
+
无
|
|
60
|
+
|
|
61
|
+
### 2.4 Slots 插槽
|
|
62
|
+
|
|
63
|
+
| 插槽名 | 说明 |
|
|
64
|
+
| :--- | :--- |
|
|
65
|
+
无
|
|
66
|
+
|
|
67
|
+
## 3. 例子 (Examples)
|
|
68
|
+
|
|
69
|
+
## 代码演示
|
|
70
|
+
|
|
71
|
+
### 基础用法
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<template>
|
|
76
|
+
<fox-menu>
|
|
77
|
+
<fox-menu-item v-model="state.value1" :options="state.options1" />
|
|
78
|
+
<fox-menu-item v-model="state.value2" @change="handleChange" :options="state.options2" />
|
|
79
|
+
</fox-menu>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script>
|
|
83
|
+
import { reactive, ref } from 'vue';
|
|
84
|
+
|
|
85
|
+
export default {
|
|
86
|
+
setup() {
|
|
87
|
+
const state = reactive({
|
|
88
|
+
options1: [
|
|
89
|
+
{ text: '全部商品', value: 0 },
|
|
90
|
+
{ text: '新款商品', value: 1 },
|
|
91
|
+
{ text: '活动商品', value: 2 }
|
|
92
|
+
],
|
|
93
|
+
options2: [
|
|
94
|
+
{ text: '默认排序', value: 'a' },
|
|
95
|
+
{ text: '好评排序', value: 'b' },
|
|
96
|
+
{ text: '销量排序', value: 'c' },
|
|
97
|
+
],
|
|
98
|
+
value1: 0,
|
|
99
|
+
value2: 'a'
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const handleChange = val => {
|
|
103
|
+
console.log('val', val);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
state,
|
|
108
|
+
handleChange
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</script>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 自定义菜单内容
|
|
116
|
+
使用实例上的 toggle 方法可以手动关闭弹框。
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
```html
|
|
120
|
+
<template>
|
|
121
|
+
<fox-menu>
|
|
122
|
+
<fox-menu-item v-model="state.value1" :options="state.options1" />
|
|
123
|
+
<fox-menu-item title="筛选" ref="item">
|
|
124
|
+
<div :style="{display: 'flex', flex: 1, 'justify-content': 'space-between', 'align-items': 'center'}">
|
|
125
|
+
<div :style="{ marginRight: '10px'}">自定义内容</div>
|
|
126
|
+
<fox-button @click="onConfirm">确认</fox-button>
|
|
127
|
+
</div>
|
|
128
|
+
</fox-menu-item>
|
|
129
|
+
</fox-menu>
|
|
130
|
+
</template>
|
|
131
|
+
|
|
132
|
+
<script>
|
|
133
|
+
import { reactive, ref } from 'vue';
|
|
134
|
+
|
|
135
|
+
export default {
|
|
136
|
+
setup() {
|
|
137
|
+
const state = reactive({
|
|
138
|
+
options1: [
|
|
139
|
+
{ text: '全部商品', value: 0 },
|
|
140
|
+
{ text: '新款商品', value: 1 },
|
|
141
|
+
{ text: '活动商品', value: 2 }
|
|
142
|
+
],
|
|
143
|
+
value1: 0
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const item = ref('');
|
|
147
|
+
|
|
148
|
+
const onConfirm = () => {
|
|
149
|
+
item.value.toggle();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
state,
|
|
154
|
+
item,
|
|
155
|
+
onConfirm
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
</script>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
### 一行两列
|
|
164
|
+
|
|
165
|
+
```html
|
|
166
|
+
<template>
|
|
167
|
+
<fox-menu>
|
|
168
|
+
<fox-menu-item v-model="state.value3" :cols="2" :options="state.options3" />
|
|
169
|
+
</fox-menu>
|
|
170
|
+
</template>
|
|
171
|
+
|
|
172
|
+
<script>
|
|
173
|
+
import { reactive, ref } from 'vue';
|
|
174
|
+
|
|
175
|
+
export default {
|
|
176
|
+
setup() {
|
|
177
|
+
const state = reactive({
|
|
178
|
+
options3: [
|
|
179
|
+
{ text: '全部商品', value: 0 },
|
|
180
|
+
{ text: '家庭清洁/纸品', value: 1 },
|
|
181
|
+
{ text: '个人护理', value: 2 },
|
|
182
|
+
{ text: '美妆护肤', value: 3 },
|
|
183
|
+
{ text: '食品饮料', value: 4 },
|
|
184
|
+
{ text: '家用电器', value: 5 },
|
|
185
|
+
{ text: '母婴', value: 6 },
|
|
186
|
+
{ text: '数码', value: 7 },
|
|
187
|
+
{ text: '电脑、办公', value: 8 },
|
|
188
|
+
{ text: '运动户外', value: 9 },
|
|
189
|
+
{ text: '厨具', value: 10 },
|
|
190
|
+
{ text: '医疗保健', value: 11 },
|
|
191
|
+
{ text: '酒类', value: 12 },
|
|
192
|
+
{ text: '生鲜', value: 13 },
|
|
193
|
+
{ text: '家具', value: 14 },
|
|
194
|
+
{ text: '传统滋补', value: 15 },
|
|
195
|
+
{ text: '汽车用品', value: 16 },
|
|
196
|
+
{ text: '家居日用', value: 17 },
|
|
197
|
+
],
|
|
198
|
+
value3: 0
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
return {
|
|
202
|
+
state
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
</script>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### 自定义选中态颜色
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
```html
|
|
213
|
+
<template>
|
|
214
|
+
<fox-menu active-color="green">
|
|
215
|
+
<fox-menu-item v-model="state.value1" :options="state.options1" />
|
|
216
|
+
<fox-menu-item v-model="state.value2" @change="handleChange" :options="state.options2" />
|
|
217
|
+
</fox-menu>
|
|
218
|
+
</template>
|
|
219
|
+
|
|
220
|
+
<script>
|
|
221
|
+
import { reactive, ref } from 'vue';
|
|
222
|
+
|
|
223
|
+
export default {
|
|
224
|
+
setup() {
|
|
225
|
+
const state = reactive({
|
|
226
|
+
options1: [
|
|
227
|
+
{ text: '全部商品', value: 0 },
|
|
228
|
+
{ text: '新款商品', value: 1 },
|
|
229
|
+
{ text: '活动商品', value: 2 }
|
|
230
|
+
],
|
|
231
|
+
options2: [
|
|
232
|
+
{ text: '默认排序', value: 'a' },
|
|
233
|
+
{ text: '好评排序', value: 'b' },
|
|
234
|
+
{ text: '销量排序', value: 'c' },
|
|
235
|
+
],
|
|
236
|
+
value1: 0,
|
|
237
|
+
value2: 'a'
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
const handleChange = val => {
|
|
241
|
+
console.log('val', val);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
state,
|
|
246
|
+
handleChange
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
</script>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### 自定义图标
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
```html
|
|
257
|
+
<template>
|
|
258
|
+
<fox-menu>
|
|
259
|
+
<fox-menu-item v-model="state.value1" :options="state.options1" titleIcon="joy-smile" />
|
|
260
|
+
<fox-menu-item v-model="state.value2" @change="handleChange" :options="state.options2" optionIcon="checklist" />
|
|
261
|
+
</fox-menu>
|
|
262
|
+
</template>
|
|
263
|
+
|
|
264
|
+
<script>
|
|
265
|
+
import { reactive, ref } from 'vue';
|
|
266
|
+
|
|
267
|
+
export default {
|
|
268
|
+
setup() {
|
|
269
|
+
const state = reactive({
|
|
270
|
+
options1: [
|
|
271
|
+
{ text: '全部商品', value: 0 },
|
|
272
|
+
{ text: '新款商品', value: 1 },
|
|
273
|
+
{ text: '活动商品', value: 2 }
|
|
274
|
+
],
|
|
275
|
+
options2: [
|
|
276
|
+
{ text: '默认排序', value: 'a' },
|
|
277
|
+
{ text: '好评排序', value: 'b' },
|
|
278
|
+
{ text: '销量排序', value: 'c' },
|
|
279
|
+
],
|
|
280
|
+
value1: 0,
|
|
281
|
+
value2: 'a'
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const handleChange = val => {
|
|
285
|
+
console.log('val', val);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return {
|
|
289
|
+
state,
|
|
290
|
+
handleChange
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
</script>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
### 向上展开
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
```html
|
|
302
|
+
<template>
|
|
303
|
+
<div class="blank"></div>
|
|
304
|
+
<fox-menu direction="up">
|
|
305
|
+
<fox-menu-item v-model="state.value1" :options="state.options1" />
|
|
306
|
+
<fox-menu-item v-model="state.value2" @change="handleChange" :options="state.options2" />
|
|
307
|
+
</fox-menu>
|
|
308
|
+
</template>
|
|
309
|
+
|
|
310
|
+
<script>
|
|
311
|
+
import { reactive, ref } from 'vue'
|
|
312
|
+
|
|
313
|
+
export default {
|
|
314
|
+
setup() {
|
|
315
|
+
const state = reactive({
|
|
316
|
+
options1: [
|
|
317
|
+
{ text: '全部商品', value: 0 },
|
|
318
|
+
{ text: '新款商品', value: 1 },
|
|
319
|
+
{ text: '活动商品', value: 2 }
|
|
320
|
+
],
|
|
321
|
+
options2: [
|
|
322
|
+
{ text: '默认排序', value: 'a' },
|
|
323
|
+
{ text: '好评排序', value: 'b' },
|
|
324
|
+
{ text: '销量排序', value: 'c' },
|
|
325
|
+
],
|
|
326
|
+
value1: 0,
|
|
327
|
+
value2: 'a'
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
const handleChange = val => {
|
|
331
|
+
console.log('val', val);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return {
|
|
335
|
+
state,
|
|
336
|
+
handleChange
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
</script>
|
|
341
|
+
<style>
|
|
342
|
+
.blank {
|
|
343
|
+
width: 200px;
|
|
344
|
+
height: 200px;
|
|
345
|
+
}
|
|
346
|
+
</style>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### 禁用菜单
|
|
350
|
+
|
|
351
|
+
```html
|
|
352
|
+
<template>
|
|
353
|
+
<fox-menu>
|
|
354
|
+
<fox-menu-item disabled v-model="state.value1" :options="state.options1" />
|
|
355
|
+
<fox-menu-item disabled v-model="state.value2" @change="handleChange" :options="state.options2" />
|
|
356
|
+
</fox-menu>
|
|
357
|
+
</template>
|
|
358
|
+
|
|
359
|
+
<script>
|
|
360
|
+
import { reactive, ref } from 'vue';
|
|
361
|
+
|
|
362
|
+
export default {
|
|
363
|
+
setup() {
|
|
364
|
+
const state = reactive({
|
|
365
|
+
options1: [
|
|
366
|
+
{ text: '全部商品', value: 0 },
|
|
367
|
+
{ text: '新款商品', value: 1 },
|
|
368
|
+
{ text: '活动商品', value: 2 }
|
|
369
|
+
],
|
|
370
|
+
options2: [
|
|
371
|
+
{ text: '默认排序', value: 'a' },
|
|
372
|
+
{ text: '好评排序', value: 'b' },
|
|
373
|
+
{ text: '销量排序', value: 'c' },
|
|
374
|
+
],
|
|
375
|
+
options3: [
|
|
376
|
+
{ text: '全部商品', value: 0 },
|
|
377
|
+
{ text: '家庭清洁/纸品', value: 1 },
|
|
378
|
+
{ text: '个人护理', value: 2 },
|
|
379
|
+
{ text: '美妆护肤', value: 3 },
|
|
380
|
+
{ text: '食品饮料', value: 4 },
|
|
381
|
+
{ text: '家用电器', value: 5 },
|
|
382
|
+
{ text: '母婴', value: 6 },
|
|
383
|
+
{ text: '数码', value: 7 },
|
|
384
|
+
{ text: '电脑、办公', value: 8 },
|
|
385
|
+
{ text: '运动户外', value: 9 },
|
|
386
|
+
{ text: '厨具', value: 10 },
|
|
387
|
+
{ text: '医疗保健', value: 11 },
|
|
388
|
+
{ text: '酒类', value: 12 },
|
|
389
|
+
{ text: '生鲜', value: 13 },
|
|
390
|
+
{ text: '家具', value: 14 },
|
|
391
|
+
{ text: '传统滋补', value: 15 },
|
|
392
|
+
{ text: '汽车用品', value: 16 },
|
|
393
|
+
{ text: '家居日用', value: 17 },
|
|
394
|
+
],
|
|
395
|
+
value1: 0,
|
|
396
|
+
value2: 'a',
|
|
397
|
+
value3: 0
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
const item = ref('');
|
|
401
|
+
|
|
402
|
+
const onConfirm = () => {
|
|
403
|
+
item.value.toggle();
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const handleChange = val => {
|
|
407
|
+
console.log('val', val);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return {
|
|
411
|
+
state,
|
|
412
|
+
item,
|
|
413
|
+
onConfirm,
|
|
414
|
+
handleChange
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
</script>
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## 4. 相关组件 (Related Components)
|
|
422
|
+
- **fox-js**: 与 Menu 配合使用的相关组件
|
|
423
|
+
- **fox-menu-item**: 与 Menu 配合使用的相关组件
|
|
424
|
+
- **fox-button**: 与 Menu 配合使用的相关组件
|
|
425
|
+
|