hy-app 0.2.12 → 0.2.14
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/compiler.ts +108 -0
- package/component-helper.ts +179 -0
- package/components/hy-button/HyButton.docgen.js +6 -0
- package/components/hy-button/hy-button.vue +152 -36
- package/components/hy-button/props.ts +157 -32
- package/components/hy-button/typing.d.ts +16 -10
- package/components/index.ts +114 -122
- package/components.json +3287 -0
- package/docgen.config.js +13 -0
- package/package.json +12 -3
- package/web-types.config.js +5 -6
- package/web-types.json +1 -3117
- package/components/hy-safe-bottom/hy-safe-bottom.vue +0 -60
- package/components/hy-safe-bottom/index.scss +0 -5
- package/components/message/TheMessage.vue +0 -169
- package/components/message/index.ts +0 -54
- package/components/u-form/form.js +0 -22
- package/components/u-form/hy-form.vue +0 -324
- package/components/u-form/props.js +0 -49
- package/components/u-form/schema.js +0 -1451
- package/components/u-form/u-form.vue +0 -267
- package/components/u-form/utils.js +0 -65
- package/components/u-form-item/formItem.js +0 -24
- package/components/u-form-item/hy-form-item.vue +0 -360
- package/components/u-form-item/props.js +0 -57
- package/components/u-form-item/u-form-item.vue +0 -294
- package/shims-vue.d.ts +0 -0
package/compiler.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import { parse } from '@vue/compiler-sfc'
|
|
4
|
+
import ts from 'typescript'
|
|
5
|
+
|
|
6
|
+
// 读取组件文件
|
|
7
|
+
const componentPath = path.resolve(__dirname, './components/hy-button/hy-button.vue')
|
|
8
|
+
const content = fs.readFileSync(componentPath, 'utf-8')
|
|
9
|
+
const { descriptor } = parse(content)
|
|
10
|
+
|
|
11
|
+
if (!descriptor.scriptSetup) {
|
|
12
|
+
console.error('未找到script setup部分')
|
|
13
|
+
process.exit(1)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 解析TypeScript类型
|
|
17
|
+
const sourceCode = descriptor.scriptSetup.content
|
|
18
|
+
const sourceFile = ts.createSourceFile('temp.ts', sourceCode, ts.ScriptTarget.Latest, true)
|
|
19
|
+
|
|
20
|
+
// 存储解析结果
|
|
21
|
+
const propsInfo: Record<
|
|
22
|
+
string,
|
|
23
|
+
{
|
|
24
|
+
type: string
|
|
25
|
+
default?: string
|
|
26
|
+
values?: string[]
|
|
27
|
+
description?: string
|
|
28
|
+
}
|
|
29
|
+
> = {}
|
|
30
|
+
|
|
31
|
+
// 遍历AST查找interface定义
|
|
32
|
+
function traverseNode(node: ts.Node) {
|
|
33
|
+
if (ts.isInterfaceDeclaration(node) && node.name.text === 'buttonProps') {
|
|
34
|
+
node.members.forEach((member) => {
|
|
35
|
+
if (ts.isPropertySignature(member) && member.name) {
|
|
36
|
+
const propName = member.name.getText()
|
|
37
|
+
const type = member.type?.getText() || 'any'
|
|
38
|
+
|
|
39
|
+
// 提取JSDoc注释中的信息
|
|
40
|
+
const jsDoc = ts.getJSDocCommentsAndTags(member)
|
|
41
|
+
const description = jsDoc
|
|
42
|
+
.filter((tag) => ts.isJSDocText(tag))
|
|
43
|
+
.map((tag) => (tag as ts.JSDocText).comment)
|
|
44
|
+
.join('\n')
|
|
45
|
+
.trim()
|
|
46
|
+
|
|
47
|
+
const valuesTag = jsDoc.find(
|
|
48
|
+
(tag) => ts.isJSDocTag(tag) && tag.tagName.text === 'values',
|
|
49
|
+
) as ts.JSDocTag | undefined
|
|
50
|
+
const values = valuesTag?.comment ? valuesTag.comment.split('|').map((v) => v.trim()) : []
|
|
51
|
+
|
|
52
|
+
propsInfo[propName] = {
|
|
53
|
+
type,
|
|
54
|
+
description: description || undefined,
|
|
55
|
+
values: values.length ? values : undefined,
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
ts.forEachChild(node, traverseNode)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
traverseNode(sourceFile)
|
|
65
|
+
|
|
66
|
+
// 解析默认值
|
|
67
|
+
const defaultsMatch = sourceCode.match(/withDefaults\(.*?,\s*({[\s\S]*?})\s*\)/)
|
|
68
|
+
if (defaultsMatch) {
|
|
69
|
+
const defaultsCode = defaultsMatch[1]
|
|
70
|
+
const defaultsSource = ts.createSourceFile(
|
|
71
|
+
'defaults.ts',
|
|
72
|
+
`const defaults = ${defaultsCode};`,
|
|
73
|
+
ts.ScriptTarget.Latest,
|
|
74
|
+
true,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
ts.forEachChild(defaultsSource, (node) => {
|
|
78
|
+
if (ts.isVariableDeclaration(node) && node.name.getText() === 'defaults') {
|
|
79
|
+
const initializer = node.initializer
|
|
80
|
+
if (ts.isObjectLiteralExpression(initializer)) {
|
|
81
|
+
initializer.properties.forEach((prop) => {
|
|
82
|
+
if (ts.isPropertyAssignment(prop)) {
|
|
83
|
+
const propName = prop.name.getText()
|
|
84
|
+
const defaultValue = prop.initializer.getText()
|
|
85
|
+
if (propsInfo[propName]) {
|
|
86
|
+
propsInfo[propName].default = defaultValue
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// 生成Markdown文档
|
|
96
|
+
let md = '## Props\n\n'
|
|
97
|
+
md += '| 属性名 | 类型 | 默认值 | 可选值 | 说明 |\n'
|
|
98
|
+
md += '|--------|------|--------|--------|------|\n'
|
|
99
|
+
|
|
100
|
+
Object.entries(propsInfo).forEach(([name, info]) => {
|
|
101
|
+
md += `| ${name} | ${info.type} | ${info.default || '-'} | ${
|
|
102
|
+
info.values ? info.values.join('、') : '-'
|
|
103
|
+
} | ${info.description || '-'} |\n`
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
// 写入文档文件
|
|
107
|
+
fs.writeFileSync(path.join(__dirname, 'docs/button-props.md'), md)
|
|
108
|
+
console.log('Props文档生成成功,包含可选值信息!')
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import fg from 'fast-glob'
|
|
2
|
+
import { read, parse, vetur, webTypes, write, isString } from 'components-helper'
|
|
3
|
+
import type {
|
|
4
|
+
Config,
|
|
5
|
+
InstallOptions,
|
|
6
|
+
NormalizeData,
|
|
7
|
+
Options,
|
|
8
|
+
ParseData,
|
|
9
|
+
ParseTable,
|
|
10
|
+
} from 'components-helper'
|
|
11
|
+
|
|
12
|
+
const config: Config = {
|
|
13
|
+
tags: 'tags.json',
|
|
14
|
+
attributes: 'attributes.json',
|
|
15
|
+
webTypes: 'web-types.json',
|
|
16
|
+
titleRegExp: /#+\s+(.*)\n+([^(#|\n)]*)/g,
|
|
17
|
+
tableRegExp: /#+\s+(.*)\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g,
|
|
18
|
+
fileNameRegExp: /\/((\w|-)+)\.\w+$/,
|
|
19
|
+
separator: ',', // values截取
|
|
20
|
+
props: 'Props',
|
|
21
|
+
propsName: 'Prop name',
|
|
22
|
+
propsType: 'Type',
|
|
23
|
+
propsDescription: 'Description',
|
|
24
|
+
propsOptions: 'Values',
|
|
25
|
+
propsDefault: 'Default',
|
|
26
|
+
events: 'events',
|
|
27
|
+
eventsName: 'Event name',
|
|
28
|
+
eventsDescription: 'Description',
|
|
29
|
+
slots: 'slots',
|
|
30
|
+
slotsName: 'Name',
|
|
31
|
+
slotsDescription: 'Description',
|
|
32
|
+
slotsType: 'Type',
|
|
33
|
+
slotsSubtags: 'Subtags',
|
|
34
|
+
directives: 'directives',
|
|
35
|
+
directivesName: 'Name',
|
|
36
|
+
directivesType: 'Type',
|
|
37
|
+
directivesDescription: 'Description',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function normalize(options: Options, data: ParseData, path: string): NormalizeData {
|
|
41
|
+
const { fileNameRegExp, props, events, slots, directives } = options
|
|
42
|
+
const _fileNameRegExp = isString(fileNameRegExp) ? new RegExp(fileNameRegExp) : fileNameRegExp
|
|
43
|
+
const _path = path.match(_fileNameRegExp)
|
|
44
|
+
const fileName = _path ? _path[1] : ''
|
|
45
|
+
const _data: NormalizeData = Object.assign(data, { path, fileName })
|
|
46
|
+
const _props = new RegExp(props, 'i')
|
|
47
|
+
const _events = new RegExp(events, 'i')
|
|
48
|
+
const _slots = new RegExp(slots, 'i')
|
|
49
|
+
const _directives = new RegExp(directives, 'i')
|
|
50
|
+
|
|
51
|
+
if (!_data.table || !_data.table.length) return _data
|
|
52
|
+
|
|
53
|
+
for (let i = 0; i < _data.table.length; i++) {
|
|
54
|
+
const item = _data.table[i]
|
|
55
|
+
const title = item.title
|
|
56
|
+
if (!title) continue
|
|
57
|
+
|
|
58
|
+
if (_props.test(title)) {
|
|
59
|
+
setData({
|
|
60
|
+
data: _data,
|
|
61
|
+
item,
|
|
62
|
+
path,
|
|
63
|
+
fileName,
|
|
64
|
+
title,
|
|
65
|
+
key: 'props',
|
|
66
|
+
regExp: _props,
|
|
67
|
+
})
|
|
68
|
+
} else if (_events.test(title)) {
|
|
69
|
+
setData({
|
|
70
|
+
data: _data,
|
|
71
|
+
item,
|
|
72
|
+
path,
|
|
73
|
+
fileName,
|
|
74
|
+
title,
|
|
75
|
+
key: 'events',
|
|
76
|
+
regExp: _events,
|
|
77
|
+
})
|
|
78
|
+
} else if (_slots.test(title)) {
|
|
79
|
+
setData({
|
|
80
|
+
data: _data,
|
|
81
|
+
item,
|
|
82
|
+
path,
|
|
83
|
+
fileName,
|
|
84
|
+
title,
|
|
85
|
+
key: 'slots',
|
|
86
|
+
regExp: _slots,
|
|
87
|
+
})
|
|
88
|
+
} else if (_directives.test(title)) {
|
|
89
|
+
setData({
|
|
90
|
+
data: _data,
|
|
91
|
+
item,
|
|
92
|
+
path,
|
|
93
|
+
fileName,
|
|
94
|
+
title,
|
|
95
|
+
key: 'directives',
|
|
96
|
+
regExp: _directives,
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return _data
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function setData({
|
|
104
|
+
data,
|
|
105
|
+
key,
|
|
106
|
+
item,
|
|
107
|
+
title,
|
|
108
|
+
path,
|
|
109
|
+
fileName,
|
|
110
|
+
regExp,
|
|
111
|
+
}: {
|
|
112
|
+
data: NormalizeData
|
|
113
|
+
key: 'props' | 'events' | 'slots' | 'directives'
|
|
114
|
+
item: ParseTable
|
|
115
|
+
title: string
|
|
116
|
+
path: string
|
|
117
|
+
fileName: string
|
|
118
|
+
regExp: RegExp
|
|
119
|
+
}) {
|
|
120
|
+
const childTitle = title.replace(regExp, '').trim()
|
|
121
|
+
|
|
122
|
+
if (childTitle) {
|
|
123
|
+
const childHeader = data.headers?.find((item) => item.title === childTitle)
|
|
124
|
+
const childItem = {
|
|
125
|
+
path,
|
|
126
|
+
fileName,
|
|
127
|
+
title: childTitle,
|
|
128
|
+
description: childHeader?.description || data.description,
|
|
129
|
+
[key]: item,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (!data.children) {
|
|
133
|
+
data.children = [childItem]
|
|
134
|
+
} else {
|
|
135
|
+
const child = data.children.find((item) => item.title === childTitle)
|
|
136
|
+
|
|
137
|
+
if (child) {
|
|
138
|
+
child[key] = item
|
|
139
|
+
} else {
|
|
140
|
+
data.children.push(childItem)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
data[key] = item
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function generateWebTypes(options = {} as InstallOptions) {
|
|
149
|
+
if (!options.entry) throw new Error('entry must be a string (non empty) or an array of strings')
|
|
150
|
+
if (!options.outDir) throw new Error('outDir must be a string (non empty)')
|
|
151
|
+
if (!options.name) console.warn('missing property "name"')
|
|
152
|
+
if (!options.version) console.warn('missing property "version"')
|
|
153
|
+
|
|
154
|
+
const _options: Options = Object.assign(config, options)
|
|
155
|
+
const files: string[] = fg.sync(_options.entry, _options.fastGlobConfig)
|
|
156
|
+
const data = files.map((path) => {
|
|
157
|
+
const fileContent = read(path)
|
|
158
|
+
const parseContent = parse(_options, fileContent)
|
|
159
|
+
const content = normalize(_options, parseContent, path)
|
|
160
|
+
content.props.content = content.props.content.map((item) => {
|
|
161
|
+
item.Values = item.Values.replace(/`|-/g, '')
|
|
162
|
+
return item
|
|
163
|
+
})
|
|
164
|
+
return content
|
|
165
|
+
})
|
|
166
|
+
const { tags, attributes } = vetur(_options, data)
|
|
167
|
+
const webTypesData = webTypes(_options, data)
|
|
168
|
+
|
|
169
|
+
write(_options, 'tags', tags)
|
|
170
|
+
write(_options, 'attributes', attributes)
|
|
171
|
+
write(_options, 'webTypes', webTypesData)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
generateWebTypes({
|
|
175
|
+
entry: './dist/docs/components/hy-button/hy-button.md', // 你的组件路径
|
|
176
|
+
outDir: 'dist', // 输出目录
|
|
177
|
+
name: 'hy-app', // 组件库名字
|
|
178
|
+
version: '0.2.14', // 版本号
|
|
179
|
+
})
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
:round="icon?.round"
|
|
48
48
|
:customStyle="icon?.customStyle || { marginRight: '2px' }"
|
|
49
49
|
></HyIcon>
|
|
50
|
+
<!-- @slot 插入默认的值 -->
|
|
50
51
|
<slot>
|
|
51
52
|
<text class="hy-button__text" :style="[{ fontSize: textSize + 'px' }]">{{ text }}</text>
|
|
52
53
|
</slot>
|
|
@@ -63,8 +64,8 @@
|
|
|
63
64
|
!disabled && !loading && !color && (plain || type === 'info')
|
|
64
65
|
? 'hy-button--active--plain'
|
|
65
66
|
: !disabled && !loading && !plain
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
? 'hy-button--active'
|
|
68
|
+
: ''
|
|
68
69
|
"
|
|
69
70
|
@click="clickHandler"
|
|
70
71
|
:class="bemClass"
|
|
@@ -126,49 +127,164 @@ export default {
|
|
|
126
127
|
|
|
127
128
|
<script setup lang="ts">
|
|
128
129
|
/**
|
|
129
|
-
*
|
|
130
|
-
* @
|
|
131
|
-
* @component hy-button
|
|
130
|
+
* 提供试剂耗材的入库、申领、出库和明细查询等操作按钮
|
|
131
|
+
* @displayName hy-button
|
|
132
132
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
// 支持 VueDocGen 生成文档时显示 JsDoc 的内容,也可以简单编写为:defineOptions({});
|
|
134
|
+
defineOptions({})
|
|
135
|
+
type MessageType = 'info' | 'primary' | 'error' | 'warning' | 'success'
|
|
136
|
+
/**
|
|
137
|
+
* 334
|
|
138
|
+
* */
|
|
139
|
+
export interface buttonProps {
|
|
140
|
+
/**
|
|
141
|
+
* 按钮类型
|
|
142
|
+
*
|
|
143
|
+
* @values primary,default,danger
|
|
144
|
+
* */
|
|
145
|
+
type: MessageType
|
|
146
|
+
}
|
|
147
|
+
// 支持 VueDocGen 生成文档时显示 JsDoc 的内容,也可以简单编写为:defineOptions({});
|
|
148
|
+
defineOptions({})
|
|
149
|
+
import { computed, type CSSProperties, toRefs, type PropType } from 'vue'
|
|
135
150
|
import { bem, throttle } from '../../utils'
|
|
136
|
-
import defaultProps from './props'
|
|
151
|
+
import { defaultProps } from './props'
|
|
137
152
|
import { ColorConfig } from '../../config'
|
|
138
153
|
import type { HyButtonProps, IButtonEmits } from './typing.d.ts'
|
|
154
|
+
import type HyIconProps from '../hy-icon/typing'
|
|
139
155
|
|
|
140
156
|
// 组件
|
|
141
157
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
142
158
|
import HyLoading from '../hy-loading/hy-loading.vue'
|
|
159
|
+
import { HyApp } from 'hy-app/typing/modules/common'
|
|
143
160
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
161
|
+
// 可选:定义 props 类型
|
|
162
|
+
// const props = withDefaults(defineProps<HyButtonProps>(), param)
|
|
163
|
+
const props = defineProps({
|
|
164
|
+
/** 是否显示按钮的细边框 */
|
|
165
|
+
hairline: {
|
|
166
|
+
type: Boolean,
|
|
167
|
+
default: false,
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* 按钮的预置样式
|
|
171
|
+
* @values info,primary,error,warning,success
|
|
172
|
+
* */
|
|
173
|
+
type: {
|
|
174
|
+
type: String as PropType<HyApp.ThemeType>,
|
|
175
|
+
default: 'primary',
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* 按钮尺寸
|
|
179
|
+
* @values large,medium,small,mini
|
|
180
|
+
* */
|
|
181
|
+
size: {
|
|
182
|
+
type: String as PropType<HyApp.SizeType | 'mini'>,
|
|
183
|
+
default: 'medium',
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* 按钮形状
|
|
187
|
+
* @values circle,square
|
|
188
|
+
* */
|
|
189
|
+
shape: {
|
|
190
|
+
type: String as PropType<HyApp.ShapeType>,
|
|
191
|
+
default: 'square',
|
|
192
|
+
},
|
|
193
|
+
/** 按钮是否镂空,背景色透明 */
|
|
194
|
+
plain: {
|
|
195
|
+
type: Boolean,
|
|
196
|
+
default: false,
|
|
197
|
+
},
|
|
198
|
+
/** 是否禁用 */
|
|
199
|
+
disabled: {
|
|
200
|
+
type: Boolean,
|
|
201
|
+
default: false,
|
|
202
|
+
},
|
|
203
|
+
/** 按钮名称前是否带 loading 图标 */
|
|
204
|
+
loading: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
default: false,
|
|
207
|
+
},
|
|
208
|
+
/** 加载中提示文字 */
|
|
209
|
+
loadingText: String,
|
|
210
|
+
/**
|
|
211
|
+
* 加载状态图标类型
|
|
212
|
+
* @values spinner,circle,semicircle
|
|
213
|
+
* */
|
|
214
|
+
loadingMode: {
|
|
215
|
+
type: String as PropType<HyApp.LoadingMode>,
|
|
216
|
+
default: 'spinner',
|
|
217
|
+
},
|
|
218
|
+
/** 加载图标大小 */
|
|
219
|
+
loadingSize: {
|
|
220
|
+
type: [Number, String],
|
|
221
|
+
default: 13,
|
|
222
|
+
},
|
|
223
|
+
/** 开放能力,具体请看uniapp稳定关于button组件部分说明 */
|
|
224
|
+
openType: String,
|
|
225
|
+
/** 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 */
|
|
226
|
+
formType: String,
|
|
227
|
+
/** 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效) */
|
|
228
|
+
appParameter: String,
|
|
229
|
+
/** 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效 */
|
|
230
|
+
hoverStopPropagation: {
|
|
231
|
+
type: Boolean,
|
|
232
|
+
default: true,
|
|
233
|
+
},
|
|
234
|
+
/** 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en ) */
|
|
235
|
+
lang: {
|
|
236
|
+
type: String,
|
|
237
|
+
default: 'en',
|
|
238
|
+
},
|
|
239
|
+
/** 会话来源,openType="contact"时有效 */
|
|
240
|
+
sessionFrom: String,
|
|
241
|
+
/** 会话内消息卡片标题,openType="contact"时有效 */
|
|
242
|
+
sendMessageTitle: String,
|
|
243
|
+
/** 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 */
|
|
244
|
+
sendMessagePath: String,
|
|
245
|
+
/** 会话内消息卡片图片,openType="contact"时有效 */
|
|
246
|
+
sendMessageImg: String,
|
|
247
|
+
/** 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效 */
|
|
248
|
+
showMessageCard: {
|
|
249
|
+
type: Boolean,
|
|
250
|
+
default: false,
|
|
251
|
+
},
|
|
252
|
+
/** 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 */
|
|
253
|
+
dataName: String,
|
|
254
|
+
/** 节流时间,一定时间内只能触发一次 */
|
|
255
|
+
throttleTime: {
|
|
256
|
+
type: Number,
|
|
257
|
+
default: 0,
|
|
258
|
+
},
|
|
259
|
+
/** 按住后多久出现点击态,单位毫秒 */
|
|
260
|
+
hoverStartTime: {
|
|
261
|
+
type: Number,
|
|
262
|
+
default: 0,
|
|
263
|
+
},
|
|
264
|
+
/** 手指松开后点击态保留时间,单位毫秒 */
|
|
265
|
+
hoverStayTime: {
|
|
266
|
+
type: Number,
|
|
267
|
+
default: 200,
|
|
268
|
+
},
|
|
269
|
+
/** 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式) */
|
|
270
|
+
text: String,
|
|
271
|
+
/** 按钮图标api集合 */
|
|
272
|
+
icon: {
|
|
273
|
+
type: Object as PropType<HyIconProps>,
|
|
274
|
+
},
|
|
275
|
+
/** 按钮颜色,支持传入linear-gradient渐变色 */
|
|
276
|
+
color: String,
|
|
277
|
+
/** 阻止事件冒泡 */
|
|
278
|
+
stop: {
|
|
279
|
+
type: Boolean,
|
|
280
|
+
default: true,
|
|
281
|
+
},
|
|
282
|
+
/** 阻止事件冒泡 */
|
|
283
|
+
customStyle: {
|
|
284
|
+
type: Object as PropType<CSSProperties>,
|
|
285
|
+
},
|
|
286
|
+
/** 阻止事件冒泡 */
|
|
287
|
+
customClass: String,
|
|
172
288
|
})
|
|
173
289
|
const { disabled, loading, throttleTime, stop, size, type, plain, color, icon } = toRefs(props)
|
|
174
290
|
const emit = defineEmits<IButtonEmits>()
|