diff --git a/src/uni_modules/uview-plus/components/up-textarea/props.uts b/src/uni_modules/uview-plus/components/up-textarea/props.uts new file mode 100644 index 000000000..6d62ede19 --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-textarea/props.uts @@ -0,0 +1,125 @@ +import { defineMixin } from '../../libs/vue' +import defProps from './textarea' +import defPropsInput from '../up-input/input' +let crtProp = defProps['textarea'] as UTSJSONObject +let crtPropInput = defPropsInput['input'] as UTSJSONObject + +export const propsTextarea = defineMixin({ + props: { + // 输入框的内容 + modelValue: { + type: String, + default: crtProp['value'] + }, + // 输入框为空时占位符 + placeholder: { + type: [String], + default: crtProp['placeholder'] + }, + // 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写::v-deep + placeholderClass: { + type: String, + default: crtPropInput['placeholderClass'] + }, + // 指定placeholder的样式 + placeholderStyle: { + type: [String, Object], + default: crtPropInput['placeholderStyle'] + }, + // 输入框高度 + height: { + type: [String, Number], + default: crtProp['height'] + }, + // 设置键盘右下角按钮的文字,仅微信小程序,App和H5有效 + confirmType: { + type: String, + default: crtProp['confirmType'] + }, + // 是否禁用 + disabled: { + type: Boolean, + default: crtProp['disabled'] + }, + // 是否显示统计字数 + count: { + type: Boolean, + default: crtProp['count'] + }, + // 是否自动获取焦点,nvue不支持,H5取决于浏览器的实现 + focus: { + type: Boolean, + default: crtProp['focus'] + }, + // 是否自动增加高度 + autoHeight: { + type: Boolean, + default: crtProp['autoHeight'] + }, + // 如果textarea是在一个position:fixed的区域,需要显示指定属性fixed为true + fixed: { + type: Boolean, + default: crtProp['fixed'] + }, + // 指定光标与键盘的距离 + cursorSpacing: { + type: Number, + default: crtProp['cursorSpacing'] + }, + // 指定focus时的光标位置 + cursor: { + type: [String, Number], + default: crtProp['cursor'] + }, + // 是否显示键盘上方带有”完成“按钮那一栏, + showConfirmBar: { + type: Boolean, + default: crtProp['showConfirmBar'] + }, + // 光标起始位置,自动聚焦时有效,需与selection-end搭配使用 + selectionStart: { + type: Number, + default: crtProp['selectionStart'] + }, + // 光标结束位置,自动聚焦时有效,需与selection-start搭配使用 + selectionEnd: { + type: Number, + default: crtProp['selectionEnd'] + }, + // 键盘弹起时,是否自动上推页面 + adjustPosition: { + type: Boolean, + default: crtProp['adjustPosition'] + }, + // 是否去掉 iOS 下的默认内边距,只微信小程序有效 + disableDefaultPadding: { + type: Boolean, + default: crtProp['disableDefaultPadding'] + }, + // focus时,点击页面的时候不收起键盘,只微信小程序有效 + holdKeyboard: { + type: Boolean, + default: crtProp['holdKeyboard'] + }, + // 最大输入长度,设置为 -1 的时候不限制最大长度 + maxlength: { + type: [String, Number], + default: crtProp['maxlength'] + }, + // 边框类型,surround-四周边框,bottom-底部边框 + border: { + type: String, + default: crtProp['border'] + }, + // 用于处理或者过滤输入框内容的方法 + formatter: { + type: [Function], + default: crtProp['formatter'] + }, + // 是否忽略组件内对文本合成系统事件的处理 + ignoreCompositionEvent: { + type: Boolean, + default: true + } + } +}) diff --git a/src/uni_modules/uview-plus/components/up-textarea/textarea.uts b/src/uni_modules/uview-plus/components/up-textarea/textarea.uts new file mode 100644 index 000000000..8217b9355 --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-textarea/textarea.uts @@ -0,0 +1,36 @@ +/* + * @Author : jry + * @Description : + * @version : 4.0 + * @Date : 2021-08-30 14:00:21 + * @LastAuthor : jry + * @lastTime : 2024-08-30 14:00:58 + * @FilePath : /uview-plus/libs/config/props/textarea + */ +export default { + // textarea 组件 + textarea: { + value: '', + placeholder: '', + placeholderClass: 'textarea-placeholder', + placeholderStyle: 'color: #c0c4cc', + height: 70, + confirmType: 'done', + disabled: false, + count: false, + focus: false, + autoHeight: false, + fixed: false, + cursorSpacing: 0, + cursor: '', + showConfirmBar: true, + selectionStart: -1, + selectionEnd: -1, + adjustPosition: true, + disableDefaultPadding: false, + holdKeyboard: false, + maxlength: 140, + border: 'surround', + formatter: function() {} + } +} as UTSJSONObject diff --git a/src/uni_modules/uview-plus/components/up-textarea/up-textarea.uvue b/src/uni_modules/uview-plus/components/up-textarea/up-textarea.uvue new file mode 100644 index 000000000..aaab7e8ce --- /dev/null +++ b/src/uni_modules/uview-plus/components/up-textarea/up-textarea.uvue @@ -0,0 +1,258 @@ + + + + + diff --git a/uni-app-x/link.sh b/uni-app-x/link.sh new file mode 100644 index 000000000..833c90cd2 --- /dev/null +++ b/uni-app-x/link.sh @@ -0,0 +1 @@ +npx @dcloudio/toolkit link uview-plus diff --git a/uni-app-x/pages.json b/uni-app-x/pages.json index 1afa97f78..8e3a7c4bb 100644 --- a/uni-app-x/pages.json +++ b/uni-app-x/pages.json @@ -295,12 +295,14 @@ // "navigationBarTitleText": "表单", // "navigationStyle": "custom" // } - // }, { - // "path": "textarea/textarea", - // "style": { - // "navigationBarTitleText": "文本域" - // } - // }, { + // } + { + "path": "textarea/textarea", + "style": { + "navigationBarTitleText": "文本域" + } + }, + // , { // "path": "noNetwork/noNetwork", // "style": { // "navigationBarTitleText": "无网络提示" diff --git a/uni-app-x/pages/componentsC/textarea/textarea.nvue b/uni-app-x/pages/componentsC/textarea/textarea.uvue similarity index 86% rename from uni-app-x/pages/componentsC/textarea/textarea.nvue rename to uni-app-x/pages/componentsC/textarea/textarea.uvue index 296465eca..6addb4851 100644 --- a/uni-app-x/pages/componentsC/textarea/textarea.nvue +++ b/uni-app-x/pages/componentsC/textarea/textarea.uvue @@ -1,4 +1,7 @@