From f8959da7ef2ad55af9e54f4440dd6f10d4f2b320 Mon Sep 17 00:00:00 2001 From: jry Date: Thu, 12 Sep 2024 21:23:00 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=96=B0=E5=A2=9Eup-picker/up-toolbar?= =?UTF-8?q?=E7=BB=84=E4=BB=B6uni-app-x=E7=89=88=E6=9C=AC=E5=8F=8A=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E6=A0=B7=E5=BC=8F=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/up-icon/up-icon.uvue | 4 +- .../up-loading-icon/up-loading-icon.uvue | 2 +- .../components/up-picker-column/props.uts | 7 + .../up-picker-column/up-picker-column.uvue | 28 ++ .../components/up-picker/picker.uts | 30 ++ .../uview-plus/components/up-picker/props.uts | 114 ++++++ .../components/up-picker/up-picker.uvue | 387 ++++++++++++++++++ .../components/up-picker/up-picker.vue | 4 +- .../components/up-popup/up-popup.uvue | 4 +- .../components/up-toolbar/props.uts | 43 ++ .../components/up-toolbar/toolbar.uts | 20 + .../components/up-toolbar/up-toolbar.uvue | 125 ++++++ .../up-transition/up-transition.uvue | 14 +- .../uview-plus/libs/css/common.scss | 9 +- src/uni_modules/uview-plus/libs/css/flex.scss | 4 +- src/uni_modules/uview-plus/libs/css/vue.scss | 2 + .../uview-plus/libs/function/index.uts | 30 +- .../uview-plus/libs/mixin/mixin.uts | 6 +- uni-app-x/pages.json | 16 +- .../picker/{picker.nvue => picker.uvue} | 71 ++-- 20 files changed, 837 insertions(+), 83 deletions(-) create mode 100644 src/uni_modules/uview-plus/components/up-picker-column/props.uts create mode 100644 src/uni_modules/uview-plus/components/up-picker-column/up-picker-column.uvue create mode 100644 src/uni_modules/uview-plus/components/up-picker/picker.uts create mode 100644 src/uni_modules/uview-plus/components/up-picker/props.uts create mode 100644 src/uni_modules/uview-plus/components/up-picker/up-picker.uvue create mode 100644 src/uni_modules/uview-plus/components/up-toolbar/props.uts create mode 100644 src/uni_modules/uview-plus/components/up-toolbar/toolbar.uts create mode 100644 src/uni_modules/uview-plus/components/up-toolbar/up-toolbar.uvue rename uni-app-x/pages/componentsC/picker/{picker.nvue => picker.uvue} (71%) diff --git a/src/uni_modules/uview-plus/components/up-icon/up-icon.uvue b/src/uni_modules/uview-plus/components/up-icon/up-icon.uvue index 96b9e774a..d7a68d7dd 100644 --- a/src/uni_modules/uview-plus/components/up-icon/up-icon.uvue +++ b/src/uni_modules/uview-plus/components/up-icon/up-icon.uvue @@ -120,8 +120,8 @@ imgStyle(): any { let style = {} // 如果设置width和height属性,则优先使用,否则使用size属性 - style['width'] = this.width != '' ? addUnit(this.width) : addUnit(this.size.toString()) - style['height'] = this.height != '' ? addUnit(this.height) : addUnit(this.size.toString()) + style['width'] = this.width != '' ? addUnit(this.width) : addUnit(this.size!!.toString()) + style['height'] = this.height != '' ? addUnit(this.height) : addUnit(this.size!!.toString()) return style }, // 通过图标名,查找对应的图标 diff --git a/src/uni_modules/uview-plus/components/up-loading-icon/up-loading-icon.uvue b/src/uni_modules/uview-plus/components/up-loading-icon/up-loading-icon.uvue index ef115f355..7ba3d62c2 100644 --- a/src/uni_modules/uview-plus/components/up-loading-icon/up-loading-icon.uvue +++ b/src/uni_modules/uview-plus/components/up-loading-icon/up-loading-icon.uvue @@ -140,7 +140,7 @@ this.array12.forEach((ele, index) => { const angle = index * (360 / 12); // 计算角度 const angleRad = angle * (Math.PI / 180); // 转换为弧度 - const banjing = this.calculateSquareRadius(parseInt(getPx(parseInt(this.size.toString()) * 2))); // 半径 + const banjing = this.calculateSquareRadius(parseInt(getPx(parseInt(this.size!!.toString()) * 2))); // 半径 const xOffset = banjing * Math.cos(angleRad); const yOffset = banjing * Math.sin(angleRad); // 假设.loading-container的position是relative,并且宽度和高度都是100% diff --git a/src/uni_modules/uview-plus/components/up-picker-column/props.uts b/src/uni_modules/uview-plus/components/up-picker-column/props.uts new file mode 100644 index 000000000..6997c8961 --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-picker-column/props.uts @@ -0,0 +1,7 @@ +import { defineMixin } from '../../libs/vue' + +export const propsPickerColumn = defineMixin({ + props: { + + } +}) diff --git a/src/uni_modules/uview-plus/components/up-picker-column/up-picker-column.uvue b/src/uni_modules/uview-plus/components/up-picker-column/up-picker-column.uvue new file mode 100644 index 000000000..5d6c61fdb --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-picker-column/up-picker-column.uvue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/uni_modules/uview-plus/components/up-picker/picker.uts b/src/uni_modules/uview-plus/components/up-picker/picker.uts new file mode 100644 index 000000000..8db7896af --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-picker/picker.uts @@ -0,0 +1,30 @@ +/* + * @Author : jry + * @Description : + * @version : 4.0 + * @Date : 2024-09-12 15:25:27 + * @LastAuthor : jry + * @lastTime : 2024-09-12 15:25:27 + * @FilePath : /uview-plus/libs/config/props/picker + */ +export default { + // picker + picker: { + show: false, + popupMode: 'bottom', + showToolbar: true, + title: '', + columns: [] as Array>, + loading: false, + itemHeight: 44, + cancelText: '取消', + confirmText: '确定', + cancelColor: '#909193', + confirmColor: '#3c9cff', + visibleItemCount: 5, + keyName: 'text', + closeOnClickOverlay: false, + defaultIndex: [] as number[], + immediateChange: true + } +} as UTSJSONObject diff --git a/src/uni_modules/uview-plus/components/up-picker/props.uts b/src/uni_modules/uview-plus/components/up-picker/props.uts new file mode 100644 index 000000000..b276ca395 --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-picker/props.uts @@ -0,0 +1,114 @@ +/* + * @Author : jry + * @Description : + * @version : 4.0 + * @Date : 2024-09-12 15:25:27 + * @LastAuthor : jry + * @lastTime : 2024-09-12 15:25:27 + * @FilePath : /uview-plus/libs/config/props/picker + */ +import { defineMixin } from '../../libs/vue' +import defProps from './picker' +let crtProp = defProps['picker'] as UTSJSONObject + +export const propsPicker = defineMixin({ + props: { + modelValue: { + type: Array, + default: [] as Array + }, + hasInput: { + type: Boolean, + default: false + }, + placeholder: { + type: String, + default: '请选择' + }, + // 是否展示picker弹窗 + show: { + type: Boolean, + default: crtProp['show'] + }, + // 弹出的方向,可选值为 top bottom right left center + popupMode: { + type: String, + default: crtProp['popupMode'] + }, + // 是否展示顶部的操作栏 + showToolbar: { + type: Boolean, + default: crtProp['showToolbar'] + }, + // 顶部标题 + title: { + type: String, + default: crtProp['title'] + }, + // 对象数组,设置每一列的数据 + columns: { + type: Array, + default: crtProp['columns'] + }, + // 是否显示加载中状态 + loading: { + type: Boolean, + default: crtProp['loading'] + }, + // 各列中,单个选项的高度 + itemHeight: { + type: [String, Number], + default: crtProp['itemHeight'] + }, + // 取消按钮的文字 + cancelText: { + type: String, + default: crtProp['cancelText'] + }, + // 确认按钮的文字 + confirmText: { + type: String, + default: crtProp['confirmText'] + }, + // 取消按钮的颜色 + cancelColor: { + type: String, + default: crtProp['cancelColor'] + }, + // 确认按钮的颜色 + confirmColor: { + type: String, + default: crtProp['confirmColor'] + }, + // 每列中可见选项的数量 + visibleItemCount: { + type: [String, Number], + default: crtProp['visibleItemCount'] + }, + // 选项对象中,需要展示的属性键名 + keyName: { + type: String, + default: crtProp['keyName'] + }, + // 是否允许点击遮罩关闭选择器 + closeOnClickOverlay: { + type: Boolean, + default: crtProp['closeOnClickOverlay'] + }, + // 各列的默认索引 + defaultIndex: { + type: Array, + default: crtProp['defaultIndex'] + }, + // 是否在手指松开时立即触发 change 事件。若不开启则会在滚动动画结束后触发 change 事件,只在微信2.21.1及以上有效 + immediateChange: { + type: Boolean, + default: crtProp['immediateChange'] + }, + // 工具栏右侧插槽是否开启 + toolbarRightSlot: { + type: Boolean, + default: false + }, + } +}) diff --git a/src/uni_modules/uview-plus/components/up-picker/up-picker.uvue b/src/uni_modules/uview-plus/components/up-picker/up-picker.uvue new file mode 100644 index 000000000..1eda930fe --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-picker/up-picker.uvue @@ -0,0 +1,387 @@ + + + + + diff --git a/src/uni_modules/uview-plus/components/up-picker/up-picker.vue b/src/uni_modules/uview-plus/components/up-picker/up-picker.vue index f82f85924..ff9121980 100644 --- a/src/uni_modules/uview-plus/components/up-picker/up-picker.vue +++ b/src/uni_modules/uview-plus/components/up-picker/up-picker.vue @@ -1,6 +1,8 @@ @@ -76,11 +76,12 @@ -