diff --git a/src/pages/componentsC/input/input.nvue b/src/pages/componentsC/input/input.nvue index c5c247119..42336e475 100644 --- a/src/pages/componentsC/input/input.nvue +++ b/src/pages/componentsC/input/input.nvue @@ -105,58 +105,36 @@ 前后插槽 - - - - - - - - + - - - - - - - - - - - - - - - + - - + - {{ title }} + + {{ title }} + @@ -13,7 +16,7 @@ + + diff --git a/src/uni_modules/uview-plus/components/up-code/up-code.vue b/src/uni_modules/uview-plus/components/up-code/up-code.vue index 08a487ef2..9159bca90 100644 --- a/src/uni_modules/uview-plus/components/up-code/up-code.vue +++ b/src/uni_modules/uview-plus/components/up-code/up-code.vue @@ -26,7 +26,7 @@ */ export default { name: "up-code", - mixins: [mpMixin, mixin,props], + mixins: [mpMixin, mixin, props], data() { return { secNum: this.seconds, diff --git a/src/uni_modules/uview-plus/components/up-input/input.uts b/src/uni_modules/uview-plus/components/up-input/input.uts new file mode 100644 index 000000000..1a9674f69 --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-input/input.uts @@ -0,0 +1,48 @@ +/* + * @Author : jry + * @Description : + * @version : 4.0 + * @Date : 2024-08-28 22:58:58 + * @LastAuthor : jry + * @lastTime : 2024-08-28 22:58:58 + * @FilePath : /uview-plus/libs/config/props/input.js + */ +export default { + // index 组件 + input: { + value: '', + type: 'text', + fixed: false, + disabled: false, + disabledColor: '#f5f7fa', + clearable: false, + password: false, + maxlength: 140, + placeholder: null, + placeholderClass: 'input-placeholder', + placeholderStyle: 'color: #c0c4cc', + showWordLimit: false, + confirmType: 'done', + confirmHold: false, + holdKeyboard: false, + focus: false, + autoBlur: false, + disableDefaultPadding: false, + cursor: -1, + cursorSpacing: 30, + selectionStart: -1, + selectionEnd: -1, + adjustPosition: true, + inputAlign: 'left', + fontSize: '15px', + color: '#303133', + prefixIcon: '', + prefixIconStyle: '', + suffixIcon: '', + suffixIconStyle: '', + border: 'surround', + readonly: false, + shape: 'square', + formatter: function() {} + } +} as UTSJSONObject diff --git a/src/uni_modules/uview-plus/components/up-input/props.uts b/src/uni_modules/uview-plus/components/up-input/props.uts new file mode 100644 index 000000000..109e546bf --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-input/props.uts @@ -0,0 +1,198 @@ +/* + * @Author : jry + * @Description : uview-plus component's props mixin file + * @version : 4.0 + * @Date : 2024-04-28 22:56:20 + * @LastAuthor : jry + * @lastTime : 2024-08-28 22:56:20 + */ +import { defineMixin } from '../../libs/vue' +import defProps from './input' +let crtProp = defProps['input'] as UTSJSONObject + +export const propsInput = defineMixin({ + props: { + // 绑定的值 + modelValue: { + type: String, + default: crtProp['value'] + }, + // number-数字输入键盘,app-vue下可以输入浮点数,app-nvue和小程序平台下只能输入整数 + // idcard-身份证输入键盘,微信、支付宝、百度、QQ小程序 + // digit-带小数点的数字键盘,App的nvue页面、微信、支付宝、百度、头条、QQ小程序 + // text-文本输入键盘 + type: { + type: String, + default: crtProp['type'] + }, + // 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true, + // 兼容性:微信小程序、百度小程序、字节跳动小程序、QQ小程序 + fixed: { + type: Boolean, + default: crtProp['fixed'] + }, + // 是否禁用输入框 + disabled: { + type: Boolean, + default: crtProp['disabled'] + }, + // 禁用状态时的背景色 + disabledColor: { + type: String, + default: crtProp['disabledColor'] + }, + // 是否显示清除控件 + clearable: { + type: Boolean, + default: crtProp['clearable'] + }, + // 是否密码类型 + password: { + type: Boolean, + default: crtProp['password'] + }, + // 最大输入长度,设置为 -1 的时候不限制最大长度 + maxlength: { + type: [Number], + default: crtProp['maxlength'] + }, + // 输入框为空时的占位符 + placeholder: { + type: String, + default: crtProp['placeholder'] + }, + // 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/ + placeholderClass: { + type: String, + default: crtProp['placeholderClass'] + }, + // 指定placeholder的样式 + placeholderStyle: { + type: [String], + default: crtProp['placeholderStyle'] + }, + // 是否显示输入字数统计,只在 type ="text"或type ="textarea"时有效 + showWordLimit: { + type: Boolean, + default: crtProp['showWordLimit'] + }, + // 设置右下角按钮的文字,有效值:send|search|next|go|done,兼容性详见uni-app文档 + // https://uniapp.dcloud.io/component/input + // https://uniapp.dcloud.io/component/textarea + confirmType: { + type: String, + default: crtProp['confirmType'] + }, + // 点击键盘右下角按钮时是否保持键盘不收起,H5无效 + confirmHold: { + type: Boolean, + default: crtProp['confirmHold'] + }, + // focus时,点击页面的时候不收起键盘,微信小程序有效 + holdKeyboard: { + type: Boolean, + default: crtProp['holdKeyboard'] + }, + // 自动获取焦点 + // 在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点 + focus: { + type: Boolean, + default: crtProp['focus'] + }, + // 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效 + autoBlur: { + type: Boolean, + default: crtProp['autoBlur'] + }, + // 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效 + disableDefaultPadding: { + type: Boolean, + default: crtProp['disableDefaultPadding'] + }, + // 指定focus时光标的位置 + cursor: { + type: [String, Number], + default: crtProp['cursor'] + }, + // 输入框聚焦时底部与键盘的距离 + cursorSpacing: { + type: [String, Number], + default: crtProp['cursorSpacing'] + }, + // 光标起始位置,自动聚集时有效,需与selection-end搭配使用 + selectionStart: { + type: [String, Number], + default: crtProp['selectionStart'] + }, + // 光标结束位置,自动聚集时有效,需与selection-start搭配使用 + selectionEnd: { + type: [String, Number], + default: crtProp['selectionEnd'] + }, + // 键盘弹起时,是否自动上推页面 + adjustPosition: { + type: Boolean, + default: crtProp['adjustPosition'] + }, + // 输入框内容对齐方式,可选值为:left|center|right + inputAlign: { + type: String, + default: crtProp['inputAlign'] + }, + // 输入框字体的大小 + fontSize: { + type: [String, Number], + default: crtProp['fontSize'] + }, + // 输入框字体颜色 + color: { + type: String, + default: crtProp['color'] + }, + // 输入框前置图标 + prefixIcon: { + type: String, + default: crtProp['prefixIcon'] + }, + // 前置图标样式,对象或字符串 + prefixIconStyle: { + type: [String, Object], + default: crtProp['prefixIconStyle'] + }, + // 输入框后置图标 + suffixIcon: { + type: String, + default: crtProp['suffixIcon'] + }, + // 后置图标样式,对象或字符串 + suffixIconStyle: { + type: [String, Object], + default: crtProp['suffixIconStyle'] + }, + // 边框类型,surround-四周边框,bottom-底部边框,none-无边框 + border: { + type: String, + default: crtProp['border'] + }, + // 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会 + readonly: { + type: Boolean, + default: crtProp['readonly'] + }, + // 输入框形状,circle-圆形,square-方形 + shape: { + type: String, + default: crtProp['shape'] + }, + // 用于处理或者过滤输入框内容的方法 + formatter: { + type: [Function], + default: crtProp['formatter'] + }, + // 是否忽略组件内对文本合成系统事件的处理 + ignoreCompositionEvent: { + type: Boolean, + default: true + } + } +}) diff --git a/src/uni_modules/uview-plus/components/up-input/up-input.uvue b/src/uni_modules/uview-plus/components/up-input/up-input.uvue new file mode 100644 index 000000000..8650fbe5e --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-input/up-input.uvue @@ -0,0 +1,391 @@ + + + + + diff --git a/src/uni_modules/uview-plus/components/up-tabs/up-tabs.vue b/src/uni_modules/uview-plus/components/up-tabs/up-tabs.vue index f9758ea67..b3dbeef43 100644 --- a/src/uni_modules/uview-plus/components/up-tabs/up-tabs.vue +++ b/src/uni_modules/uview-plus/components/up-tabs/up-tabs.vue @@ -128,7 +128,11 @@ handler (newValue, oldValue) { // 内外部值不相等时,才尝试移动滑块 if (newValue !== this.innerCurrent) { - this.innerCurrent = newValue + if (typeof newValue == 'string') { + this.innerCurrent = parseInt(newValue) + } else { + this.innerCurrent = newValue + } this.$nextTick(() => { this.resize() }) @@ -147,7 +151,9 @@ return index => { const style = {} // 取当期是否激活的样式 - const customeStyle = index === this.innerCurrent ? addStyle(this.activeStyle) : addStyle(this.inactiveStyle) + const customeStyle = (index == this.innerCurrent) + ? addStyle(this.activeStyle) + : addStyle(this.inactiveStyle) // 如果当前菜单被禁用,则加上对应颜色,需要在此做处理,是因为nvue下,无法在style样式中通过!import覆盖标签的内联样式 if (this.list[index].disabled) { style.color = '#c8c9cc' diff --git a/src/uni_modules/uview-plus/libs/function/index.uts b/src/uni_modules/uview-plus/libs/function/index.uts index 7ce36b803..fffa4fdb8 100644 --- a/src/uni_modules/uview-plus/libs/function/index.uts +++ b/src/uni_modules/uview-plus/libs/function/index.uts @@ -619,7 +619,7 @@ export function priceFormat(numberOri: any, decimals = 0, decimalPoint = '.', th * @param {*} instance * @param {*} event */ -export function formValidate(instance, event): void { +export function formValidate(instance: any, event: any): void { // todox // const formItem = uni.$u.$parent.call(instance, 'up-form-item') // const form = uni.$u.$parent.call(instance, 'up-form') diff --git a/uni-app-x/pages/componentsC/input/input.nvue b/uni-app-x/pages/componentsC/input/input.uvue similarity index 68% rename from uni-app-x/pages/componentsC/input/input.nvue rename to uni-app-x/pages/componentsC/input/input.uvue index 175dd50de..ea69d2732 100644 --- a/uni-app-x/pages/componentsC/input/input.nvue +++ b/uni-app-x/pages/componentsC/input/input.uvue @@ -1,4 +1,7 @@ -