Skip to content

Commit

Permalink
chore(van): add watermark treeSelect uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Jul 20, 2023
1 parent 34a001e commit 34d81a8
Show file tree
Hide file tree
Showing 4 changed files with 394 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ui/vant/vant4/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ import tabbarItem from './tabbarItem.json'
import tag from './tag.json'
import textEllipsis from './textEllipsis.json'
import timePicker from './timePicker.json'
import treeSelect from './treeSelect.json'
import uploader from './uploader.json'
import watermark from './watermark.json'

export function vant4() {
const map: any = [
Expand Down Expand Up @@ -184,6 +187,9 @@ export function vant4() {
tag,
textEllipsis,
timePicker,
treeSelect,
uploader,
watermark,
]

return propsReducer(map)
Expand Down Expand Up @@ -417,6 +423,13 @@ export function vant4Components() {
['van-tag', '标签 用于标记关键词和概括主要内容。', '<van-tag type="primary">标签</van-tag>'],
['van-text-ellipsis', '文本省略 对长文本进行省略,支持展开/收起。请升级 vant 到 >= 4.1.0 版本来使用该组件。', '<van-text-ellipsis :content="text" />'],
['van-time-picker', '时间选择 时间选择器,通常与弹出层组件配合使用。', '<van-time-picker v-model="currentTime" title="选择时间" />'],
['van-tree-select', '分类选择 用于从一组相关联的数据集合中进行选择。', `<van-tree-select
v-model:active-id="activeId"
v-model:main-active-index="activeIndex"
:items="items"
/>`],
['van-uploader', '文件上传 用于将本地的图片或文件上传至服务器,并在上传过程中展示预览图和上传进度。目前 Uploader 组件不包含将文件上传至服务器的接口逻辑,该步骤需要自行实现。', '<van-uploader :after-read="afterRead" />'],
['van-watermark', '水印 在页面上添加特定的文字或图案作为水印,可用于防止信息盗用。请升级 vant 到 >= 4.2.0 版本来使用该组件。', '<van-watermark content="Vant" />'],
]
return componentsReducer(map)
}
101 changes: 101 additions & 0 deletions src/ui/vant/vant4/treeSelect.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"name": "VanTreeSelect",
"props": {
"v-model:main-active-index": {
"value": "",
"description": "左侧选中项的索引",
"default": "0",
"type": "左侧选中项的索引"
},
"v-model:active-id": {
"value": "",
"description": "右侧选中项的 id,支持传入数组",
"default": "0",
"type": "右侧选中项的 id,支持传入数组"
},
"items": {
"value": "",
"description": "分类显示所需的数据",
"default": "[]",
"type": "分类显示所需的数据"
},
"height": {
"value": "",
"description": "高度,默认单位为`px`",
"default": "300",
"type": "高度,默认单位为px"
},
"max": {
"value": "",
"description": "右侧项最大选中个数",
"default": "Infinity",
"type": "右侧项最大选中个数"
},
"selected-icon": {
"value": "",
"description": "自定义右侧栏选中状态的图标",
"default": "success",
"type": "自定义右侧栏选中状态的图标"
}
},
"methods": [],
"typeDetail": {
"TreeSelectItem": [
{
"name": "text",
"description": "导航名称",
"type": "string"
},
{
"name": "badge",
"description": "导航名称右上角徽标",
"type": "number"
},
{
"name": "dot",
"description": "是否在导航名称右上角显示小红点",
"type": "boolean"
},
{
"name": "className",
"description": "导航节点额外类名",
"type": "string"
},
{
"name": "children",
"description": "该导航下所有的可选项",
"type": "TreeSelectItemChild"
}
],
"TreeSelectItemChild": [
{
"name": "text",
"description": "名称",
"type": "string"
},
{
"name": "id",
"description": "id,作为匹配选中状态的标识符",
"type": "number"
},
{
"name": "disabled",
"description": "禁用选项",
"type": "boolean"
}
]
},
"events": [
{
"name": "click-nav",
"description": "点击左侧导航时触发",
"params": "点击左侧导航时触发"
},
{
"name": "click-item",
"description": "点击右侧选择项时触发",
"params": "点击右侧选择项时触发"
}
],
"link": "https://vant-contrib.gitee.io/vant/#/zh-CN/tree-select"
}
205 changes: 205 additions & 0 deletions src/ui/vant/vant4/uploader.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
{
"name": "VanUploader",
"props": {
"v-model": {
"value": "",
"description": "已上传的文件列表",
"default": "-",
"type": "已上传的文件列表"
},
"accept": {
"value": [
"image",
"*"
],
"description": "允许上传的文件类型,[详细说明](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input/file#%E9%99%90%E5%88%B6%E5%85%81%E8%AE%B8%E7%9A%84%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B)",
"default": "image | *",
"type": "允许上传的文件类型,[详细说明](https: | | developer.mozilla.org | zh-CN | docs | Web | HTML | Element | Input | file#%E9%99%90%E5%88%B6%E5%85%81%E8%AE%B8%E7%9A%84%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B)"
},
"name": {
"value": "",
"description": "标识符,通常为一个唯一的字符串或数字,可以在回调函数的第二项参数中获取",
"default": "-",
"type": "标识符,通常为一个唯一的字符串或数字,可以在回调函数的第二项参数中获取"
},
"preview-size": {
"value": "",
"description": "预览图和上传区域的尺寸,默认单位为 `px`",
"default": "80px",
"type": "预览图和上传区域的尺寸,默认单位为 px"
},
"preview-image": {
"value": "",
"description": "是否在上传完成后展示预览图",
"default": "true",
"type": "是否在上传完成后展示预览图"
},
"preview-full-image": {
"value": "",
"description": "是否在点击预览图后展示全屏图片预览",
"default": "true",
"type": "是否在点击预览图后展示全屏图片预览"
},
"preview-options": {
"value": "",
"description": "全屏图片预览的配置项,可选值见 [ImagePreview](#/zh-CN/image-preview)",
"default": "-",
"type": "全屏图片预览的配置项,可选值见 [ImagePreview](# | zh-CN | image-preview)"
},
"multiple": {
"value": "",
"description": "是否开启图片多选,部分安卓机型不支持",
"default": "false",
"type": "是否开启图片多选,部分安卓机型不支持"
},
"disabled": {
"value": "",
"description": "是否禁用文件上传",
"default": "false",
"type": "是否禁用文件上传"
},
"readonly": {
"value": "",
"description": "是否将上传区域设置为只读状态",
"default": "false",
"type": "是否将上传区域设置为只读状态"
},
"deletable": {
"value": "",
"description": "是否展示删除按钮",
"default": "true",
"type": "是否展示删除按钮"
},
"reupload `v4.4.0`": {
"value": "",
"description": "是否开启覆盖上传,开启后会关闭图片预览",
"default": "false",
"type": "是否开启覆盖上传,开启后会关闭图片预览"
},
"show-upload": {
"value": "",
"description": "是否展示上传区域",
"default": "true",
"type": "是否展示上传区域"
},
"lazy-load": {
"value": "",
"description": "是否开启图片懒加载,须配合 [Lazyload](#/zh-CN/lazyload) 组件使用",
"default": "false",
"type": "是否开启图片懒加载,须配合 [Lazyload](# | zh-CN | lazyload) 组件使用"
},
"capture": {
"value": "",
"description": "图片选取模式,可选值为 `camera` (直接调起摄像头)",
"default": "-",
"type": "图片选取模式,可选值为 camera (直接调起摄像头)"
},
"after-read": {
"value": "",
"description": "文件读取完成后的回调函数",
"default": "-",
"type": "文件读取完成后的回调函数"
},
"before-read": {
"value": "",
"description": "文件读取前的回调函数,返回 `false` 可终止文件读取, 支持返回 `Promise`",
"default": "-",
"type": "文件读取前的回调函数,返回 false 可终止文件读取, 支持返回 Promise"
},
"before-delete": {
"value": "",
"description": "文件删除前的回调函数,返回 `false` 可终止文件读取, 支持返回 `Promise`",
"default": "-",
"type": "文件删除前的回调函数,返回 false 可终止文件读取, 支持返回 Promise"
},
"max-size": {
"value": "",
"description": "文件大小限制,单位为 `byte`",
"default": "Infinity",
"type": "文件大小限制,单位为 byte"
},
"max-count": {
"value": "",
"description": "文件上传数量限制",
"default": "Infinity",
"type": "文件上传数量限制"
},
"result-type": {
"value": "",
"description": "文件读取结果类型,可选值为 `file` `text`",
"default": "dataUrl",
"type": "文件读取结果类型,可选值为 file text"
},
"upload-text": {
"value": "",
"description": "上传区域文字提示",
"default": "-",
"type": "上传区域文字提示"
},
"image-fit": {
"value": "",
"description": "预览图裁剪模式,可选值见 [Image](#/zh-CN/image) 组件",
"default": "cover",
"type": "预览图裁剪模式,可选值见 [Image](# | zh-CN | image) 组件"
},
"upload-icon": {
"value": "",
"description": "上传区域图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/zh-CN/icon#props)",
"default": "photograph",
"type": "上传区域图标名称或图片链接,等同于 Icon 组件的 [name 属性](# | zh-CN | icon#props)"
}
},
"methods": [],
"typeDetail": {
"ResultType": [
{
"name": "file",
"description": "结果仅包含 File 对象",
"type": ""
},
{
"name": "text",
"description": "结果包含 File 对象,以及文件的文本内容",
"type": ""
},
{
"name": "dataUrl",
"description": "结果包含 File 对象,以及文件对应的 base64 编码",
"type": ""
}
]
},
"events": [
{
"name": "oversize",
"description": "文件大小超过限制时触发",
"params": "文件大小超过限制时触发"
},
{
"name": "click-upload",
"description": "点击上传区域时触发",
"params": "点击上传区域时触发"
},
{
"name": "click-preview",
"description": "点击预览图时触发",
"params": "点击预览图时触发"
},
{
"name": "click-reupload",
"description": "点击覆盖上传时触发",
"params": "点击覆盖上传时触发"
},
{
"name": "close-preview",
"description": "关闭全屏图片预览时触发",
"params": "关闭全屏图片预览时触发"
},
{
"name": "delete",
"description": "删除文件预览时触发",
"params": "删除文件预览时触发"
}
],
"link": "https://vant-contrib.gitee.io/vant/#/zh-CN/uploader"
}
Loading

0 comments on commit 34d81a8

Please sign in to comment.