瀏覽代碼

uview-plus依赖更新

fanghuisheng 1 年之前
父節點
當前提交
7433667404
共有 100 個文件被更改,包括 1286 次插入943 次删除
  1. 60 0
      src/uni_modules/uview-plus/changelog.md
  2. 2 2
      src/uni_modules/uview-plus/components/u--form/u--form.vue
  3. 2 2
      src/uni_modules/uview-plus/components/u--image/u--image.vue
  4. 2 2
      src/uni_modules/uview-plus/components/u--input/u--input.vue
  5. 2 2
      src/uni_modules/uview-plus/components/u--textarea/u--textarea.vue
  6. 7 5
      src/uni_modules/uview-plus/components/u-action-sheet/u-action-sheet.vue
  7. 9 7
      src/uni_modules/uview-plus/components/u-album/u-album.vue
  8. 9 6
      src/uni_modules/uview-plus/components/u-alert/u-alert.vue
  9. 9 5
      src/uni_modules/uview-plus/components/u-avatar-group/u-avatar-group.vue
  10. 2 1
      src/uni_modules/uview-plus/components/u-avatar/props.js
  11. 12 11
      src/uni_modules/uview-plus/components/u-avatar/u-avatar.vue
  12. 9 8
      src/uni_modules/uview-plus/components/u-back-top/u-back-top.vue
  13. 10 6
      src/uni_modules/uview-plus/components/u-badge/u-badge.vue
  14. 13 9
      src/uni_modules/uview-plus/components/u-button/u-button.vue
  15. 2 2
      src/uni_modules/uview-plus/components/u-calendar/header.vue
  16. 17 15
      src/uni_modules/uview-plus/components/u-calendar/month.vue
  17. 26 10
      src/uni_modules/uview-plus/components/u-calendar/u-calendar.vue
  18. 7 6
      src/uni_modules/uview-plus/components/u-car-keyboard/u-car-keyboard.vue
  19. 8 4
      src/uni_modules/uview-plus/components/u-cell-group/u-cell-group.vue
  20. 13 9
      src/uni_modules/uview-plus/components/u-cell/u-cell.vue
  21. 3 3
      src/uni_modules/uview-plus/components/u-checkbox-group/u-checkbox-group.vue
  22. 13 11
      src/uni_modules/uview-plus/components/u-checkbox/u-checkbox.vue
  23. 5 4
      src/uni_modules/uview-plus/components/u-circle-progress/u-circle-progress.vue
  24. 9 8
      src/uni_modules/uview-plus/components/u-code-input/u-code-input.vue
  25. 5 5
      src/uni_modules/uview-plus/components/u-code/u-code.vue
  26. 9 8
      src/uni_modules/uview-plus/components/u-col/u-col.vue
  27. 240 222
      src/uni_modules/uview-plus/components/u-collapse-item/u-collapse-item.vue
  28. 3 3
      src/uni_modules/uview-plus/components/u-collapse/u-collapse.vue
  29. 8 6
      src/uni_modules/uview-plus/components/u-column-notice/u-column-notice.vue
  30. 3 3
      src/uni_modules/uview-plus/components/u-count-down/u-count-down.vue
  31. 6 4
      src/uni_modules/uview-plus/components/u-count-to/u-count-to.vue
  32. 33 24
      src/uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.vue
  33. 7 5
      src/uni_modules/uview-plus/components/u-divider/u-divider.vue
  34. 7 5
      src/uni_modules/uview-plus/components/u-dropdown-item/u-dropdown-item.vue
  35. 12 10
      src/uni_modules/uview-plus/components/u-dropdown/u-dropdown.vue
  36. 12 8
      src/uni_modules/uview-plus/components/u-empty/u-empty.vue
  37. 18 12
      src/uni_modules/uview-plus/components/u-form-item/u-form-item.vue
  38. 12 11
      src/uni_modules/uview-plus/components/u-form/u-form.vue
  39. 3 3
      src/uni_modules/uview-plus/components/u-gap/u-gap.vue
  40. 14 9
      src/uni_modules/uview-plus/components/u-grid-item/u-grid-item.vue
  41. 18 7
      src/uni_modules/uview-plus/components/u-grid/u-grid.vue
  42. 21 19
      src/uni_modules/uview-plus/components/u-icon/u-icon.vue
  43. 18 16
      src/uni_modules/uview-plus/components/u-image/u-image.vue
  44. 11 9
      src/uni_modules/uview-plus/components/u-index-anchor/u-index-anchor.vue
  45. 6 5
      src/uni_modules/uview-plus/components/u-index-item/u-index-item.vue
  46. 24 21
      src/uni_modules/uview-plus/components/u-index-list/u-index-list.vue
  47. 19 11
      src/uni_modules/uview-plus/components/u-input/u-input.vue
  48. 3 3
      src/uni_modules/uview-plus/components/u-keyboard/u-keyboard.vue
  49. 11 8
      src/uni_modules/uview-plus/components/u-line-progress/u-line-progress.vue
  50. 7 6
      src/uni_modules/uview-plus/components/u-line/u-line.vue
  51. 9 8
      src/uni_modules/uview-plus/components/u-link/u-link.vue
  52. 5 4
      src/uni_modules/uview-plus/components/u-list-item/u-list-item.vue
  53. 26 3
      src/uni_modules/uview-plus/components/u-list/props.js
  54. 33 10
      src/uni_modules/uview-plus/components/u-list/u-list.vue
  55. 15 13
      src/uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.vue
  56. 10 7
      src/uni_modules/uview-plus/components/u-loading-page/u-loading-page.vue
  57. 12 10
      src/uni_modules/uview-plus/components/u-loadmore/u-loadmore.vue
  58. 8 5
      src/uni_modules/uview-plus/components/u-modal/u-modal.vue
  59. 12 7
      src/uni_modules/uview-plus/components/u-navbar/u-navbar.vue
  60. 6 6
      src/uni_modules/uview-plus/components/u-no-network/u-no-network.vue
  61. 6 5
      src/uni_modules/uview-plus/components/u-notice-bar/u-notice-bar.vue
  62. 19 15
      src/uni_modules/uview-plus/components/u-notify/u-notify.vue
  63. 8 7
      src/uni_modules/uview-plus/components/u-number-box/u-number-box.vue
  64. 7 7
      src/uni_modules/uview-plus/components/u-number-keyboard/u-number-keyboard.vue
  65. 5 5
      src/uni_modules/uview-plus/components/u-overlay/u-overlay.vue
  66. 6 5
      src/uni_modules/uview-plus/components/u-parse/u-parse.vue
  67. 3 3
      src/uni_modules/uview-plus/components/u-picker-column/u-picker-column.vue
  68. 22 18
      src/uni_modules/uview-plus/components/u-picker/u-picker.vue
  69. 14 13
      src/uni_modules/uview-plus/components/u-popup/u-popup.vue
  70. 1 1
      src/uni_modules/uview-plus/components/u-qrcode/u-qrcode.vue
  71. 3 3
      src/uni_modules/uview-plus/components/u-radio-group/u-radio-group.vue
  72. 12 12
      src/uni_modules/uview-plus/components/u-radio/u-radio.vue
  73. 16 14
      src/uni_modules/uview-plus/components/u-rate/u-rate.vue
  74. 9 7
      src/uni_modules/uview-plus/components/u-read-more/u-read-more.vue
  75. 15 12
      src/uni_modules/uview-plus/components/u-row-notice/u-row-notice.vue
  76. 8 7
      src/uni_modules/uview-plus/components/u-row/u-row.vue
  77. 5 4
      src/uni_modules/uview-plus/components/u-safe-bottom/u-safe-bottom.vue
  78. 6 3
      src/uni_modules/uview-plus/components/u-scroll-list/nvue.js
  79. 13 10
      src/uni_modules/uview-plus/components/u-scroll-list/u-scroll-list.vue
  80. 10 0
      src/uni_modules/uview-plus/components/u-search/props.js
  81. 12 6
      src/uni_modules/uview-plus/components/u-search/u-search.vue
  82. 20 17
      src/uni_modules/uview-plus/components/u-skeleton/u-skeleton.vue
  83. 2 1
      src/uni_modules/uview-plus/components/u-slider/mpwxs.js
  84. 2 2
      src/uni_modules/uview-plus/components/u-slider/nvue - 副本.js
  85. 2 2
      src/uni_modules/uview-plus/components/u-slider/nvue.js
  86. 8 5
      src/uni_modules/uview-plus/components/u-slider/u-slider.vue
  87. 6 5
      src/uni_modules/uview-plus/components/u-status-bar/u-status-bar.vue
  88. 14 12
      src/uni_modules/uview-plus/components/u-steps-item/u-steps-item.vue
  89. 5 4
      src/uni_modules/uview-plus/components/u-steps/u-steps.vue
  90. 12 10
      src/uni_modules/uview-plus/components/u-sticky/u-sticky.vue
  91. 8 6
      src/uni_modules/uview-plus/components/u-subsection/u-subsection.vue
  92. 3 3
      src/uni_modules/uview-plus/components/u-swipe-action-item/nvue - backup.js
  93. 3 3
      src/uni_modules/uview-plus/components/u-swipe-action-item/nvue.js
  94. 8 5
      src/uni_modules/uview-plus/components/u-swipe-action-item/u-swipe-action-item.vue
  95. 3 3
      src/uni_modules/uview-plus/components/u-swipe-action/u-swipe-action.vue
  96. 10 7
      src/uni_modules/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue
  97. 35 24
      src/uni_modules/uview-plus/components/u-swiper/u-swiper.vue
  98. 15 13
      src/uni_modules/uview-plus/components/u-switch/u-switch.vue
  99. 7 5
      src/uni_modules/uview-plus/components/u-tabbar-item/u-tabbar-item.vue
  100. 6 5
      src/uni_modules/uview-plus/components/u-tabbar/u-tabbar.vue

+ 60 - 0
src/uni_modules/uview-plus/changelog.md

@@ -1,3 +1,63 @@
+## 3.2.22(2024-05-13)
+上传组件支持微信小程序预览视频
+
+修复折叠面板右侧箭头不显示
+
+修复uxp2px
+
+## 3.2.21(2024-05-10)
+fix: loading-icon修复flex布局
+## 3.2.20(2024-05-10)
+修复瀑布流大小写#355
+## 3.2.19(2024-05-10)
+去除意外的文件引入
+## 3.2.18(2024-05-09)
+fix: 349 popup 组件设置 zIndex 属性后,组件渲染异常#
+feat: 搜索框增加adjustPosition属性
+fix: #331增加u-action-sheet__cancel
+优化mixin兼容性
+feat: #326 up-list增加下拉刷新功能
+fix: #319 优化up-tabs参数与定义匹配
+fix: index-list组件微信小程序端使用自定义导航栏异常
+fix: #285 pickerimmediateChange 写死为true
+fix: #111 u-scroll-list组件,隐藏指示器后报错, 提示找不到ref
+list增加微信小程序防抖配置
+
+## 3.2.17(2024-05-08)
+fix: 支付宝小程序二维码渲染
+## 3.2.16(2024-05-06)
+修复tabs中,当前激活样式的undefined bug
+
+fix: #341u-code 倒计时没结束前退出,再次进入结束后退出界面,再次进入重新开始倒计时bug
+
+受到uni-app内置text样式影响修复
+
+## 3.2.15(2024-04-28)
+优化时间选择器hasInput模式初始化值
+## 3.2.14(2024-04-24)
+去除pleaseSetTranspileDependencies
+
+http采用useStore
+
+## 3.2.13(2024-04-22)
+修复modal标题样式
+
+优化日期选择器hasInput模式宽度
+
+## 3.2.12(2024-04-22)
+修复color应用
+## 3.2.11(2024-04-18)
+修复import化带来的问题
+## 3.2.10(2024-04-17)
+完善input清空事件App端失效的兼容性
+
+修复日历组件二次打开后当前月份显示不正确
+
+## 3.2.9(2024-04-16)
+组件内uni.$u用法改为import引入
+
+规范化及兼容性增强
+
 ## 3.2.8(2024-04-15)
 修复up-tag语法错
 ## 3.2.7(2024-04-15)

+ 2 - 2
src/uni_modules/uview-plus/components/u--form/u--form.vue

@@ -22,8 +22,8 @@
 	 */
 	import uvForm from '../u-form/u-form.vue';
 	import props from '../u-form/props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	export default {
 		// #ifdef MP-WEIXIN
 		name: 'u-form',

+ 2 - 2
src/uni_modules/uview-plus/components/u--image/u--image.vue

@@ -37,8 +37,8 @@
 	 */
 	import uvImage from '../u-image/u-image.vue';
 	import props from '../u-image/props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	export default {
 		name: 'u--image',
 		mixins: [mpMixin, props, mixin],

+ 2 - 2
src/uni_modules/uview-plus/components/u--input/u--input.vue

@@ -62,8 +62,8 @@
 	 */
 	import uvInput from '../u-input/u-input.vue';
 	import props from '../u-input/props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	export default {
 		name: 'u--input',
 		mixins: [mpMixin, props, mixin],

+ 2 - 2
src/uni_modules/uview-plus/components/u--textarea/u--textarea.vue

@@ -35,8 +35,8 @@
 	 */
 	import uvTextarea from '../u-textarea/u-textarea.vue';
 	import props from '../u-textarea/props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	export default {
 		name: 'u--textarea',
 		mixins: [mpMixin, props, mixin],

+ 7 - 5
src/uni_modules/uview-plus/components/u-action-sheet/u-action-sheet.vue

@@ -92,7 +92,8 @@
 			    height="6"
 			    v-if="cancelText"
 			></u-gap>
-			<view hover-class="u-action-sheet--hover">
+			<view class="u-action-sheet__item-wrap__item u-action-sheet__cancel"
+				hover-class="u-action-sheet--hover">
 				<text
 				    @touchmove.stop.prevent
 				    :hover-stay-time="150"
@@ -108,9 +109,10 @@
 <script>
 	import openType from '../../libs/mixin/openType'
 	import button from '../../libs/mixin/button'
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit } from '../../libs/function/index';
 	/**
 	 * ActionSheet 操作菜单
 	 * @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。本组件功能类似于uni的uni.showActionSheetAPI,配置更加灵活,所有平台都表现一致。
@@ -159,7 +161,7 @@
 				return (index) => {
 					let style = {};
 					if (this.actions[index].color) style.color = this.actions[index].color
-					if (this.actions[index].fontSize) style.fontSize = uni.$u.addUnit(this.actions[index].fontSize)
+					if (this.actions[index].fontSize) style.fontSize = addUnit(this.actions[index].fontSize)
 					// 选项被禁用的样式
 					if (this.actions[index].disabled) style.color = '#c0c4cc'
 					return style;

+ 9 - 7
src/uni_modules/uview-plus/components/u-album/u-album.vue

@@ -53,9 +53,11 @@
 </template>
 
 <script>
-import props from './props.js';
-import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+import props from './props';
+import mpMixin from '../../libs/mixin/mpMixin';
+import mixin from '../../libs/mixin/mixin';
+import { addUnit, sleep } from '../../libs/function/index';
+import test from '../../libs/function/test';
 // #ifdef APP-NVUE
 // 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
 const dom = uni.requireNativePlugin('dom')
@@ -146,12 +148,12 @@ export default {
             return arr
         },
         imageWidth() {
-            return uni.$u.addUnit(
+            return addUnit(
                 this.urls.length === 1 ? this.singleWidth : this.multipleSize
             )
         },
         imageHeight() {
-            return uni.$u.addUnit(
+            return addUnit(
                 this.urls.length === 1 ? this.singleHeight : this.multipleSize
             )
         },
@@ -183,7 +185,7 @@ export default {
         },
         // 获取图片的路径
         getSrc(item) {
-            return uni.$u.test.object(item)
+            return test.object(item)
                 ? (this.keyName && item[this.keyName]) || item.src
                 : item
         },
@@ -212,7 +214,7 @@ export default {
         // 获取组件的宽度
         async getComponentWidth() {
             // 延时一定时间,以获取dom尺寸
-            await uni.$u.sleep(30)
+            await sleep(30)
             // #ifndef APP-NVUE
             this.$uGetRect('.u-album__row').then((size) => {
                 this.singleWidth = size.width * this.singlePercent

+ 9 - 6
src/uni_modules/uview-plus/components/u-alert/u-alert.vue

@@ -7,7 +7,7 @@
 		    class="u-alert"
 		    :class="[`u-alert--${type}--${effect}`]"
 		    @tap.stop="clickHandler"
-		    :style="[$u.addStyle(customStyle)]"
+		    :style="[addStyle(customStyle)]"
 		>
 			<view
 			    class="u-alert__icon"
@@ -29,7 +29,7 @@
 				    class="u-alert__content__title"
 				    v-if="title"
 					:style="[{
-						fontSize: $u.addUnit(fontSize),
+						fontSize: addUnit(fontSize),
 						textAlign: center ? 'center' : 'left'
 					}]"
 				    :class="[effect === 'dark' ? 'u-alert__text--dark' : `u-alert__text--${type}--light`]"
@@ -38,7 +38,7 @@
 				    class="u-alert__content__desc"
 					v-if="description"
 					:style="[{
-						fontSize: $u.addUnit(fontSize),
+						fontSize: addUnit(fontSize),
 						textAlign: center ? 'center' : 'left'
 					}]"
 				    :class="[effect === 'dark' ? 'u-alert__text--dark' : `u-alert__text--${type}--light`]"
@@ -60,9 +60,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle } from '../../libs/function/index';
 	/**
 	 * Alert  警告提示
 	 * @description 警告提示,展现需要关注的信息。
@@ -117,6 +118,8 @@
 		},
 		emits: ["click"],
 		methods: {
+			addUnit,
+			addStyle,
 			// 点击内容
 			clickHandler() {
 				this.$emit('click')

+ 9 - 5
src/uni_modules/uview-plus/components/u-avatar-group/u-avatar-group.vue

@@ -5,14 +5,14 @@
 		    v-for="(item, index) in showUrl"
 		    :key="index"
 		    :style="{
-				marginLeft: index === 0 ? 0 : $u.addUnit(-size * gap)
+				marginLeft: index === 0 ? 0 : addUnit(-size * gap)
 			}"
 		>
 			<u-avatar
 			    :size="size"
 			    :shape="shape"
 			    :mode="mode"
-			    :src="$u.test.object(item) ? keyName && item[keyName] || item.url : item"
+			    :src="testObject(item) ? keyName && item[keyName] || item.url : item"
 			></u-avatar>
 			<view
 			    class="u-avatar-group__item__show-more"
@@ -32,9 +32,11 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit } from '../../libs/function/index';
+	import test from '../../libs/function/test';
 	/**
 	 * AvatarGroup  头像组
 	 * @description 本组件一般用于展示头像的地方,如个人中心,或者评论列表页的用户头像展示等场所。
@@ -67,6 +69,8 @@
 		},
 		emits: ["showMore"],
 		methods: {
+			addUnit,
+			testObject: test.object,
 			clickHandler() {
 				this.$emit('showMore')
 			}

+ 2 - 1
src/uni_modules/uview-plus/components/u-avatar/props.js

@@ -1,4 +1,5 @@
 import defProps from '../../libs/config/props.js';
+import test from '../../libs/function/test';
 export default {
     props: {
         // 头像图片路径(不能为相对路径)
@@ -66,7 +67,7 @@ export default {
             type: [String, Number],
             // 校验参数规则,索引在0-19之间
             validator(n) {
-                return uni.$u.test.range(n, [0, 19]) || n === ''
+                return test.range(n, [0, 19]) || n === ''
             },
             default: () => defProps.avatar.colorIndex
         },

文件差異過大導致無法顯示
+ 12 - 11
src/uni_modules/uview-plus/components/u-avatar/u-avatar.vue


+ 9 - 8
src/uni_modules/uview-plus/components/u-back-top/u-back-top.vue

@@ -24,9 +24,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, getPx, deepMerge, error } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	const dom = weex.requireModule('dom')
 	// #endif
@@ -56,8 +57,8 @@
 			backTopStyle() {
 				// 动画组件样式
 				const style = {
-					bottom: uni.$u.addUnit(this.bottom),
-					right: uni.$u.addUnit(this.right),
+					bottom: addUnit(this.bottom),
+					right: addUnit(this.right),
 					width: '40px',
 					height: '40px',
 					position: 'fixed',
@@ -66,7 +67,7 @@
 				return style
 			},
 			show() {
-				return uni.$u.getPx(this.scrollTop) > uni.$u.getPx(this.top)
+				return getPx(this.scrollTop) > getPx(this.top)
 			},
 			contentStyle() {
 				const style = {}
@@ -82,7 +83,7 @@
 				style.borderTopRightRadius = radius
 				style.borderBottomLeftRadius = radius
 				style.borderBottomRightRadius = radius
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		},
 		emits: ["click"],
@@ -90,7 +91,7 @@
 			backToTop() {
 				// #ifdef APP-NVUE
 				if (!this.$parent.$refs['u-back-top']) {
-					uni.$u.error(`nvue页面需要给页面最外层元素设置"ref='u-back-top'`)
+					error(`nvue页面需要给页面最外层元素设置"ref='u-back-top'`)
 				}
 				dom.scrollToElement(this.$parent.$refs['u-back-top'], {
 					offset: 0

+ 10 - 6
src/uni_modules/uview-plus/components/u-badge/u-badge.vue

@@ -2,15 +2,16 @@
 	<text
 		v-if="show && ((Number(value) === 0 ? showZero : true) || isDot)"
 		:class="[isDot ? 'u-badge--dot' : 'u-badge--not-dot', inverted && 'u-badge--inverted', shape === 'horn' && 'u-badge--horn', `u-badge--${type}${inverted ? '--inverted' : ''}`]"
-		:style="[$u.addStyle(customStyle), badgeStyle]"
+		:style="[addStyle(customStyle), badgeStyle]"
 		class="u-badge"
 	>{{ isDot ? '' :showValue }}</text>
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, addUnit } from '../../libs/function/index';
 	/**
 	 * badge 徽标数
 	 * @description 该组件一般用于图标右上角显示未读的消息数量,提示用户点击,有圆点和圆包含文字两种形式。
@@ -57,8 +58,8 @@
 						// top和right分为为offset的第一个和第二个值,如果没有第二个值,则right等于top
 						const top = this.offset[0]
 						const right = this.offset[1] || top
-						style.top = uni.$u.addUnit(top)
-						style.right = uni.$u.addUnit(right)
+						style.top = addUnit(top)
+						style.right = addUnit(right)
 					}
 				}
 				return style
@@ -80,6 +81,9 @@
 						return Number(this.value)
 				}
 			},
+		},
+		methods: {
+			addStyle
 		}
 	}
 </script>

+ 13 - 9
src/uni_modules/uview-plus/components/u-button/u-button.vue

@@ -22,7 +22,7 @@
         @agreeprivacyauthorization="agreeprivacyauthorization"
         :hover-class="!disabled && !loading ? 'u-button--active' : ''"
         class="u-button u-reset-button"
-        :style="[baseColor, $u.addStyle(customStyle)]"
+        :style="[baseColor, addStyle(customStyle)]"
         @tap="clickHandler"
         :class="bemClass"
     >
@@ -71,7 +71,7 @@
         "
         @tap="clickHandler"
         :class="bemClass"
-        :style="[baseColor, $u.addStyle(customStyle)]"
+        :style="[baseColor, addStyle(customStyle)]"
     >
         <template v-if="loading">
             <u-loading-icon
@@ -110,11 +110,14 @@
 </template>
 
 <script lang="ts">
-import button from "../../libs/mixin/button.js";
-import openType from "../../libs/mixin/openType.js";
-import mpMixin from '../../libs/mixin/mpMixin.js';
-import mixin from '../../libs/mixin/mixin.js';
-import props from "./props.js";
+import button from "../../libs/mixin/button";
+import openType from "../../libs/mixin/openType";
+import mpMixin from '../../libs/mixin/mpMixin';
+import mixin from '../../libs/mixin/mixin';
+import props from "./props";
+import { addStyle } from '../../libs/function/index';
+import { throttle } from '../../libs/function/throttle';
+import color from '../../libs/config/color';
 /**
  * button 按钮
  * @description Button 按钮
@@ -194,7 +197,7 @@ export default {
                 // 如果有设置color值,则用color值,否则使用type主题颜色
                 return this.color
                     ? this.color
-                    : uni.$u.config.color[`u-${this.type}`];
+                    : color[`u-${this.type}`];
             }
             if (this.type === "info") {
                 return "#c9c9c9";
@@ -267,11 +270,12 @@ export default {
 	emits: ['click', 'getphonenumber', 'getuserinfo',
 		'error', 'opensetting', 'launchapp', 'agreeprivacyauthorization'],
     methods: {
+        addStyle,
         clickHandler() {
             // 非禁止并且非加载中,才能点击
             if (!this.disabled && !this.loading) {
 				// 进行节流控制,每this.throttle毫秒内,只在开始处执行
-				uni.$u.throttle(() => {
+				throttle(() => {
 					this.$emit("click");
 				}, this.throttleTime);
             }

+ 2 - 2
src/uni_modules/uview-plus/components/u-calendar/header.vue

@@ -21,8 +21,8 @@
 </template>
 
 <script>
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	export default {
 		name: 'u-calendar-header',
 		mixins: [mpMixin, mixin],

+ 17 - 15
src/uni_modules/uview-plus/components/u-calendar/month.vue

@@ -31,10 +31,12 @@
 	// 由于nvue不支持百分比单位,需要查询宽度来计算每个日期的宽度
 	const dom = uni.requireNativePlugin('dom')
 	// #endif
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-	import defprops from '../../libs/config/props';
-	// import dayjs from '../../libs/util/dayjs.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, deepClone, toast, sleep } from '../../libs/function/index';
+	import { colorGradient } from '../../libs/function/colorGradient';
+	import test from '../../libs/function/test';
+	import defProps from '../../libs/config/props';
 	import dayjs from 'dayjs/esm/index'
 	export default {
 		name: 'u-calendar-month',
@@ -103,7 +105,7 @@
 			// 是否为只读状态,只读状态下禁止选择日期
 			readonly: {
 				type: Boolean,
-				default: () => uni.$u.props.calendar.readonly
+				default: () => defProps.calendar.readonly
 			},
 			// 日期区间最多可选天数,默认无限制,mode = range时有效
 			maxRange: {
@@ -156,13 +158,13 @@
 					const dayWidth = Number(parseFloat(this.width / 7).toFixed(3).slice(0, -1))
 					// 得出每个日期的宽度
 					// #ifdef APP-NVUE
-					style.width = uni.$u.addUnit(dayWidth)
+					style.width = addUnit(dayWidth)
 					// #endif
-					style.height = uni.$u.addUnit(this.rowHeight)
+					style.height = addUnit(this.rowHeight)
 					if (index2 === 0) {
 						// 获取当前为星期几,如果为0,则为星期天,减一为每月第一天时,需要向左偏移的item个数
 						week = (week === 0 ? 7 : week) - 1
-						style.marginLeft = uni.$u.addUnit(week * dayWidth)
+						style.marginLeft = addUnit(week * dayWidth)
 					}
 					if (this.mode === 'range') {
 						// 之所以需要这么写,是因为DCloud公司的iOS客户端的开发者能力有限导致的bug
@@ -206,7 +208,7 @@
 							// 处于第一和最后一个之间的日期,背景色设置为浅色,通过将对应颜色进行等分,再取其尾部的颜色值
 							if (dayjs(date).isAfter(dayjs(this.selected[0])) && dayjs(date).isBefore(dayjs(this
 									.selected[len]))) {
-								style.backgroundColor = uni.$u.colorGradient(this.color, '#ffffff', 100)[90]
+								style.backgroundColor = colorGradient(this.color, '#ffffff', 100)[90]
 								// 增加一个透明度,让范围区间的背景色也能看到底部的mark水印字符
 								style.opacity = 0.7
 							}
@@ -289,7 +291,7 @@
 				this.$nextTick(() => {
 					// 这里需要另一个延时,因为获取宽度后,会进行月份数据渲染,只有渲染完成之后,才有真正的高度
 					// 因为nvue下,$nextTick并不是100%可靠的
-					uni.$u.sleep(10).then(() => {
+					sleep(10).then(() => {
 						this.getWrapperWidth()
 						this.getMonthRect()
 					})
@@ -361,7 +363,7 @@
 				const date = dayjs(item.date).format("YYYY-MM-DD")
 				if (item.disabled) return
 				// 对上一次选择的日期数组进行深度克隆
-				let selected = uni.$u.deepClone(this.selected)
+				let selected = deepClone(this.selected)
 				if (this.mode === 'single') {
 					// 单选情况下,让数组中的元素为当前点击的日期
 					selected = [date]
@@ -389,9 +391,9 @@
 							// 当前日期减去最大可选的日期天数,如果大于起始时间,则进行提示
 							if(dayjs(dayjs(date).subtract(this.maxRange, 'day')).isAfter(dayjs(selected[0])) && this.showRangePrompt) {
 								if(this.rangePrompt) {
-									uni.$u.toast(this.rangePrompt)
+									toast(this.rangePrompt)
 								} else {
-									uni.$u.toast(`选择天数不能超过 ${this.maxRange} 天`)
+									toast(`选择天数不能超过 ${this.maxRange} 天`)
 								}
 								return
 							}
@@ -431,14 +433,14 @@
 				const maxDate = this.maxDate || dayjs(minDate).add(this.maxMonth - 1, 'month').format("YYYY-MM-DD")
 				if (this.mode === 'single') {
 					// 单选模式,可以是字符串或数组,Date对象等
-					if (!uni.$u.test.array(this.defaultDate)) {
+					if (!test.array(this.defaultDate)) {
 						defaultDate = [dayjs(this.defaultDate).format("YYYY-MM-DD")]
 					} else {
 						defaultDate = [this.defaultDate[0]]
 					}
 				} else {
 					// 如果为非数组,则不执行
-					if (!uni.$u.test.array(this.defaultDate)) return
+					if (!test.array(this.defaultDate)) return
 					defaultDate = this.defaultDate
 				}
 				// 过滤用户传递的默认数组,取出只在可允许最大值与最小值之间的元素

+ 26 - 10
src/uni_modules/uview-plus/components/u-calendar/u-calendar.vue

@@ -16,7 +16,7 @@
 			></uHeader>
 			<scroll-view
 				:style="{
-                    height: $u.addUnit(listHeight)
+                    height: addUnit(listHeight)
                 }"
 				scroll-y
 				@scroll="onScroll"
@@ -68,11 +68,12 @@ import uHeader from './header.vue'
 import uMonth from './month.vue'
 import props from './props.js'
 import util from './util.js'
-// import dayjs from '../../libs/util/dayjs.min.js'
 import dayjs from 'dayjs/esm/index'
 import Calendar from '../../libs/util/calendar.js'
 import mpMixin from '../../libs/mixin/mpMixin.js'
 import mixin from '../../libs/mixin/mixin.js'
+import { addUnit, range, error, padZero } from '../../libs/function/index';
+import test from '../../libs/function/test';
 /**
  * Calendar 日历
  * @description  此组件用于单个选择日期,范围选择日期等,日历被包裹在底部弹起的容器中.
@@ -129,12 +130,19 @@ export default {
 			// month组件中选择的日期数组
 			selected: [],
 			scrollIntoView: '',
+			scrollIntoViewScroll: '',
 			scrollTop:0,
 			// 过滤处理方法
 			innerFormatter: (value) => value
 		}
 	},
 	watch: {
+		scrollIntoView: {
+			immediate: true,
+			handler(n) {
+				// console.log('scrollIntoView', n)
+			}
+		},
 		selectedChange: {
 			immediate: true,
 			handler(n) {
@@ -145,19 +153,25 @@ export default {
 		show: {
 			immediate: true,
 			handler(n) {
-				this.setMonth()
+				if (n) {
+					this.setMonth()
+				} else {
+					// 关闭时重置scrollIntoView,否则会出现二次打开日历,当前月份数据显示不正确。
+					// scrollIntoView需要有一个值变动过程,才会产生作用。
+					this.scrollIntoView = ''
+				}
 			}
 		}
 	},
 	computed: {
 		// 由于maxDate和minDate可以为字符串(2021-10-10),或者数值(时间戳),但是dayjs如果接受字符串形式的时间戳会有问题,这里进行处理
 		innerMaxDate() {
-			return uni.$u.test.number(this.maxDate)
+			return test.number(this.maxDate)
 				? Number(this.maxDate)
 				: this.maxDate
 		},
 		innerMinDate() {
-			return uni.$u.test.number(this.minDate)
+			return test.number(this.minDate)
 				? Number(this.minDate)
 				: this.minDate
 		},
@@ -194,6 +208,7 @@ export default {
 	},
 	emits: ["confirm", "close"],
 	methods: {
+		addUnit,
 		// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
 		setFormatter(e) {
 			this.innerFormatter = e
@@ -224,7 +239,7 @@ export default {
                 this.innerMinDate &&
 				new Date(this.innerMaxDate).getTime() < new Date(this.innerMinDate).getTime()
 			) {
-				return uni.$u.error('maxDate不能小于minDate时间')
+				return error('maxDate不能小于minDate时间')
 			}
 			// 滚动区域的高度
 			this.listHeight = this.rowHeight * 5 + 30
@@ -258,7 +273,7 @@ export default {
 					.add(this.monthNum - 1, 'month')
 					.valueOf()
 			// 最大最小月份之间的共有多少个月份,
-			const months = uni.$u.range(
+			const months = range(
 				1,
 				this.monthNum,
 				this.getMonths(minDate, maxDate)
@@ -321,7 +336,6 @@ export default {
 					year: dayjs(minDate).add(i, 'month').year()
 				})
 			}
-
 		},
 		// 滚动到默认设置的月份
 		scrollIntoDefaultMonth(selected) {
@@ -330,13 +344,14 @@ export default {
 				  year,
 				  month
 			  }) => {
-				month = uni.$u.padZero(month)
+				month = padZero(month)
 				return `${year}-${month}` === selected
 			})
 			if (_index !== -1) {
 				// #ifndef MP-WEIXIN
 				this.$nextTick(() => {
 					this.scrollIntoView = `month-${_index}`
+					this.scrollIntoViewScroll = this.scrollIntoView
 				})
 				// #endif
 				// #ifdef MP-WEIXIN
@@ -352,6 +367,7 @@ export default {
 			for (let i = 0; i < this.months.length; i++) {
 				if (scrollTop >= (this.months[i].top || this.listHeight)) {
 					this.monthIndex = i
+					this.scrollIntoViewScroll = `month-${i}`
 				}
 			}
 		},
@@ -371,7 +387,7 @@ export default {
 			}
 			let selected = dayjs().format("YYYY-MM");
 			// 单选模式,可以是字符串或数组,Date对象等
-			if (!uni.$u.test.array(this.defaultDate)) {
+			if (!test.array(this.defaultDate)) {
 				selected = dayjs(this.defaultDate).format("YYYY-MM")
 			} else {
 				selected = dayjs(this.defaultDate[0]).format("YYYY-MM");

+ 7 - 6
src/uni_modules/uview-plus/components/u-car-keyboard/u-car-keyboard.vue

@@ -68,9 +68,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { randomArray, sleep } from '../../libs/function/index';
 	/**
 	 * keyboard 键盘组件
 	 * @description 此为uView自定义的键盘面板,内含了数字键盘,车牌号键,身份证号键盘3种模式,都有可以打乱按键顺序的选项。
@@ -131,7 +132,7 @@
 				];
 				let tmp = [];
 				// 打乱顺序
-				if (this.random) data = uni.$u.randomArray(data);
+				if (this.random) data = randomArray(data);
 				// 切割成二维数组
 				tmp[0] = data.slice(0, 10);
 				tmp[1] = data.slice(10, 20);
@@ -179,7 +180,7 @@
 					'M'
 				];
 				let tmp = [];
-				if (this.random) data = uni.$u.randomArray(data);
+				if (this.random) data = randomArray(data);
 				tmp[0] = data.slice(0, 10);
 				tmp[1] = data.slice(10, 20);
 				tmp[2] = data.slice(20, 30);
@@ -196,7 +197,7 @@
 				if (this.abc) value = this.engKeyBoardList[i][j];
 				else value = this.areaList[i][j];
 				// 如果允许自动切换,则将中文状态切换为英文
-				if (!this.abc && this.autoChange) uni.$u.sleep(200).then(() => this.abc = true)
+				if (!this.abc && this.autoChange) sleep(200).then(() => this.abc = true)
 				this.$emit('change', value);
 			},
 			// 修改汽车牌键盘的输入模式,中文|英文

+ 8 - 4
src/uni_modules/uview-plus/components/u-cell-group/u-cell-group.vue

@@ -1,5 +1,5 @@
 <template>
-    <view :style="[$u.addStyle(customStyle)]" :class="[customClass]" class="u-cell-group">
+    <view :style="[addStyle(customStyle)]" :class="[customClass]" class="u-cell-group">
         <view v-if="title" class="u-cell-group__title">
             <slot name="title">
 				<text class="u-cell-group__title__text">{{ title }}</text>
@@ -13,9 +13,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle } from '../../libs/function/index';
 	/**
 	 * cellGroup  单元格
 	 * @description cell单元格一般用于一组列表的情况,比如个人中心页,设置页等。
@@ -31,6 +32,9 @@
 	export default {
 		name: 'u-cell-group',
 		mixins: [mpMixin, mixin, props],
+		methods: {
+			addStyle
+		}
 	}
 </script>
 

+ 13 - 9
src/uni_modules/uview-plus/components/u-cell/u-cell.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="u-cell" :class="[customClass]" :style="[$u.addStyle(customStyle)]"
+	<view class="u-cell" :class="[customClass]" :style="[addStyle(customStyle)]"
 		:hover-class="(!disabled && (clickable || isLink)) ? 'u-cell--clickable' : ''" :hover-stay-time="250"
 		@tap="clickHandler">
 		<view class="u-cell__body" :class="[ center && 'u-cell--center', size === 'large' && 'u-cell__body--large']">
@@ -26,13 +26,14 @@
 			<slot name="value">
 				<text class="u-cell__value"
 					:class="[disabled && 'u-cell--disabled', size === 'large' && 'u-cell__value--large']"
-					v-if="!$u.test.empty(value)">{{ value }}</text>
+					v-if="!testEmpty(value)">{{ value }}</text>
 			</slot>
 			<view class="u-cell__right-icon-wrap" v-if="$slots['right-icon'] || isLink"
 				:class="[`u-cell__right-icon-wrap--${arrowDirection}`]">
-				<slot name="right-icon">
-					<u-icon v-if="rightIcon" :name="rightIcon" :custom-style="rightIconStyle" :color="disabled ? '#c8c9cc' : 'info'"
-						:size="size === 'large' ? 18 : 16"></u-icon>
+				<u-icon v-if="rightIcon && !$slots['right-icon']" :name="rightIcon"
+					:custom-style="rightIconStyle" :color="disabled ? '#c8c9cc' : 'info'"
+					:size="size === 'large' ? 18 : 16"></u-icon>
+				<slot v-else name="right-icon">
 				</slot>
 			</view>
 			<view class="u-cell__right-icon-wrap" v-if="$slots['righticon']"
@@ -46,10 +47,11 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-	import { addStyle } from '../../libs/function/index.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle } from '../../libs/function/index';
+	import test from '../../libs/function/test';
 	/**
 	 * cell  单元格
 	 * @description cell单元格一般用于一组列表的情况,比如个人中心页,设置页等。
@@ -93,6 +95,8 @@
 		},
 		emits: ['click'],
 		methods: {
+			addStyle,
+			testEmpty: test.empty,
 			// 点击cell
 			clickHandler(e) {
 				if (this.disabled) return

+ 3 - 3
src/uni_modules/uview-plus/components/u-checkbox-group/u-checkbox-group.vue

@@ -8,9 +8,9 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	/**
 	 * checkboxGroup 复选框组
 	 * @description 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便

+ 13 - 11
src/uni_modules/uview-plus/components/u-checkbox/u-checkbox.vue

@@ -32,9 +32,11 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, addUnit, deepMerge, formValidate, error } from '../../libs/function/index';
+	import test from '../../libs/function/test';
 	/**
 	 * checkbox  复选框
 	 * @description 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便
@@ -123,7 +125,7 @@
 			},
 			// label大小
 			elLabelSize() {
-				return uni.$u.addUnit(this.labelSize ? this.labelSize : (this.parentData.labelSize ? this.parentData.labelSize :
+				return addUnit(this.labelSize ? this.labelSize : (this.parentData.labelSize ? this.parentData.labelSize :
 					'15'))
 			},
 			elIconColor() {
@@ -158,8 +160,8 @@
 				const style = {}
 				style.backgroundColor = this.isChecked && !this.elDisabled ? this.elActiveColor : '#ffffff'
 				style.borderColor = this.isChecked && !this.elDisabled ? this.elActiveColor : this.elInactiveColor
-				style.width = uni.$u.addUnit(this.elSize)
-				style.height = uni.$u.addUnit(this.elSize)
+				style.width = addUnit(this.elSize)
+				style.height = addUnit(this.elSize)
 				// 如果是图标在右边的话,移除它的右边距
 				if (!this.usedAlone) {
 					if (this.parentData.iconPlacement === 'right') {
@@ -172,14 +174,14 @@
 				const style = {}
 				if (!this.usedAlone) {
 					if (this.parentData.borderBottom && this.parentData.placement === 'row') {
-						uni.$u.error('检测到您将borderBottom设置为true,需要同时将u-checkbox-group的placement设置为column才有效')
+						error('检测到您将borderBottom设置为true,需要同时将u-checkbox-group的placement设置为column才有效')
 					}
 					// 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔
 					if (this.parentData.borderBottom && this.parentData.placement === 'column') {
 						style.paddingBottom = '8px'
 					}
 				}
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		},
 		mounted() {
@@ -192,7 +194,7 @@
 					// 支付宝小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环引用
 					this.updateParentData()
 					if (!this.parent) {
-						uni.$u.error('u-checkbox必须搭配u-checkbox-group组件使用')
+						error('u-checkbox必须搭配u-checkbox-group组件使用')
 					}
 				}
 				// #ifdef VUE2
@@ -204,7 +206,7 @@
 				// 设置初始化时,是否默认选中的状态,父组件u-checkbox-group的value可能是array,所以额外判断
 				if (this.checked) {
 					this.isChecked = true
-				} else if (!this.usedAlone && uni.$u.test.array(value)) {
+				} else if (!this.usedAlone && test.array(value)) {
 					// 查找数组是是否存在this.name元素值
 					this.isChecked = value.some(item => {
 						return item === this.name
@@ -242,7 +244,7 @@
 				this.$emit('change', this.isChecked)
 				// 尝试调用u-form的验证方法,进行一定延迟,否则微信小程序更新可能会不及时
 				this.$nextTick(() => {
-					uni.$u.formValidate(this, 'change')
+					formValidate(this, 'change')
 				})
 			},
 			// 改变组件选中状态

+ 5 - 4
src/uni_modules/uview-plus/components/u-circle-progress/u-circle-progress.vue

@@ -27,9 +27,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import {sleep } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	const animation = uni.requireNativePlugin('animation')
 	// #endif
@@ -64,7 +65,7 @@
 			}
 		},
 		mounted() {
-			uni.$u.sleep().then(() => {
+			sleep().then(() => {
 				this.rightBorderColor = 'rgb(66, 185, 131)'
 				// this.init()
 			})

+ 9 - 8
src/uni_modules/uview-plus/components/u-code-input/u-code-input.vue

@@ -13,7 +13,7 @@
 			<text
 				v-else
 				:style="{
-					fontSize: $u.addUnit(fontSize),
+					fontSize: addUnit(fontSize),
 					fontWeight: bold ? 'bold' : 'normal',
 					color: color
 				}"
@@ -37,7 +37,7 @@
 			class="u-code-input__input"
 			@input="inputHandler"
 			:style="{
-				height: $u.addUnit(size) 
+				height: addUnit(size)
 			}"
 			@focus="isFocus = true"
 			@blur="isFocus = false"
@@ -46,9 +46,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, getPx } from '../../libs/function/index';
 	/**
 	 * CodeInput 验证码输入
 	 * @description 该组件一般用于验证用户短信验证码的场景,也可以结合uview-plus的键盘组件使用
@@ -103,7 +104,6 @@
 			// 循环item的样式
 			itemStyle() {
 				return index => {
-					const addUnit = uni.$u.addUnit
 					const style = {
 						width: addUnit(this.size),
 						height: addUnit(this.size)
@@ -113,7 +113,7 @@
 						// 设置盒子的边框,如果是细边框,则设置为0.5px宽度
 						style.border = `${this.hairline ? 0.5 : 1}px solid ${this.borderColor}`
 						// 如果盒子间距为0的话
-						if (uni.$u.getPx(this.space) === 0) {
+						if (getPx(this.space) === 0) {
 							// 给第一和最后一个盒子设置圆角
 							if (index === 0) {
 								style.borderTopLeftRadius = '3px'
@@ -148,7 +148,7 @@
 			lineStyle() {
 				const style = {}
 				style.height = this.hairline ? '2px' : '4px'
-				style.width = uni.$u.addUnit(this.size)
+				style.width = addUnit(this.size)
 				// 线条模式下,背景色即为边框颜色
 				style.backgroundColor = this.borderColor
 				return style
@@ -156,6 +156,7 @@
 		},
 		emits: ["change", 'finish', "update:modelValue"],
 		methods: {
+			addUnit,
 			// 监听输入框的值发生变化
 			inputHandler(e) {
 				const value = e.detail.value

+ 5 - 5
src/uni_modules/uview-plus/components/u-code/u-code.vue

@@ -5,9 +5,9 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	/**
 	 * Code 验证码输入框
 	 * @description 考虑到用户实际发送验证码的场景,可能是一个按钮,也可能是一段文字,提示语各有不同,所以本组件 不提供界面显示,只提供提示语,由用户将提示语嵌入到具体的场景
@@ -104,10 +104,10 @@
 			},
 			// 保存时间戳,为了防止倒计时尚未结束,H5刷新或者各端的右上角返回上一页再进来
 			setTimeToStorage() {
-				if(!this.keepRunning) return
+				if(!this.keepRunning || !this.timer) return
 				// 记录当前的时间戳,为了下次进入页面,如果还在倒计时内的话,继续倒计时
 				// 倒计时尚未结束,结果大于0;倒计时已经开始,就会小于初始值,如果等于初始值,说明没有开始倒计时,无需处理
-				if(this.secNum > 0 && this.secNum <= this.seconds) {
+				if(this.secNum > 0 && this.secNum < this.seconds) {
 					// 获取当前时间戳(+ new Date()为特殊写法),除以1000变成秒,再去除小数部分
 					let nowTimestamp = Math.floor((+ new Date()) / 1000)
 					// 将本该结束时候的时间戳保存起来 => 当前时间戳 + 剩余的秒数

+ 9 - 8
src/uni_modules/uview-plus/components/u-col/u-col.vue

@@ -13,9 +13,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, addUnit, deepMerge, getPx } from '../../libs/function/index';
 	/**
 	 * CodeInput 栅格系统的列 
 	 * @description 该组件一般用于Layout 布局 通过基础的 12 分栏,迅速简便地创建布局
@@ -59,8 +60,8 @@
 			colStyle() {
 				const style = {
 					// 这里写成"padding: 0 10px"的形式是因为nvue的需要
-					paddingLeft: uni.$u.addUnit(uni.$u.getPx(this.parentData.gutter)/2),
-					paddingRight: uni.$u.addUnit(uni.$u.getPx(this.parentData.gutter)/2),
+					paddingLeft: addUnit(getPx(this.parentData.gutter)/2),
+					paddingRight: addUnit(getPx(this.parentData.gutter)/2),
 					alignItems: this.uAlignItem,
 					justifyContent: this.uJustify,
 					textAlign: this.textAlign,
@@ -71,11 +72,11 @@
 					// #endif
 					// #ifdef APP-NVUE
 					// 在nvue上,由于无法使用百分比单位,这里需要获取父组件的宽度,再计算得出该有对应的百分比尺寸
-					width: uni.$u.addUnit(Math.floor(this.width / this.gridNum * Number(this.span))),
-					marginLeft: uni.$u.addUnit(Math.floor(this.width / this.gridNum * Number(this.offset))),
+					width: addUnit(Math.floor(this.width / this.gridNum * Number(this.span))),
+					marginLeft: addUnit(Math.floor(this.width / this.gridNum * Number(this.offset))),
 					// #endif
 				}
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		},
 		mounted() {

+ 240 - 222
src/uni_modules/uview-plus/components/u-collapse-item/u-collapse-item.vue

@@ -1,222 +1,240 @@
-<template>
-	<view class="u-collapse-item">
-		<u-cell
-			:title="$slots.title ? '' : title"
-			:value="value"
-			:label="label"
-			:icon="icon"
-			:isLink="isLink"
-			:clickable="clickable"
-			:border="parentData.border && showBorder"
-			@click="clickHandler"
-			:arrowDirection="expanded ? 'up' : 'down'"
-			:disabled="disabled"
-		>
-			<!-- 微信小程序不支持,因为微信中不支持 <slot name="title" slot="title" />的写法 -->
-			<template #title>
				<slot name="title">
					<text v-if="!$slots.title && title">
						{{title}}
					</text>
				</slot>
			</template>
			<template #icon>
-				<slot name="icon">
					<u-icon v-if="!$slots.icon && icon" :size="22" :name="icon"></u-icon>
				</slot>
-			</template>
-			<template #value>
-				<slot name="value">
					<text v-if="!$slots.value && value">
						{{value}}
					</text>
				</slot>
-			</template>
-			<template #right-icon>
-				<slot name="right-icon">
				</slot>
-			</template>
-		</u-cell>
-		<view
-			class="u-collapse-item__content"
-			:animation="animationData"
-			ref="animation"
-		>
-			<view
-				class="u-collapse-item__content__text content-class"
-				:id="elId"
-				:ref="elId"
-			><slot /></view>
-		</view>
-		<u-line v-if="parentData.border"></u-line>
-	</view>
-</template>
-
-<script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-	import { nextTick } from 'vue'
-	// #ifdef APP-NVUE
-	const animation = uni.requireNativePlugin('animation')
-	const dom = uni.requireNativePlugin('dom')
-	// #endif
-	/**
-	 * collapseItem 折叠面板Item
-	 * @description 通过折叠面板收纳内容区域(搭配u-collapse使用)
-	 * @tutorial https://ijry.github.io/uview-plus/components/collapse.html
-	 * @property {String}			title 		标题
-	 * @property {String}			value 		标题右侧内容
-	 * @property {String}			label 		标题下方的描述信息
-	 * @property {Boolean}			disbled 	是否禁用折叠面板 ( 默认 false )
-	 * @property {Boolean}			isLink 		是否展示右侧箭头并开启点击反馈 ( 默认 true )
-	 * @property {Boolean}			clickable	是否开启点击反馈 ( 默认 true )
-	 * @property {Boolean}			border		是否显示内边框 ( 默认 true )
-	 * @property {String}			align		标题的对齐方式 ( 默认 'left' )
-	 * @property {String | Number}	name		唯一标识符
-	 * @property {String}			icon		标题左侧图片,可为绝对路径的图片或内置图标
-	 * @event {Function}			change 			某个item被打开或者收起时触发
-	 * @example <u-collapse-item :title="item.head" v-for="(item, index) in itemList" :key="index">{{item.body}}</u-collapse-item>
-	 */
-	export default {
-		name: "u-collapse-item",
-		mixins: [mpMixin, mixin, props],
-		data() {
-			return {
-				elId: uni.$u.guid(),
-				// uni.createAnimation的导出数据
-				animationData: {},
-				// 是否展开状态
-				expanded: false,
-				// 根据expanded确定是否显示border,为了控制展开时,cell的下划线更好的显示效果,进行一定时间的延时
-				showBorder: false,
-				// 是否动画中,如果是则不允许继续触发点击
-				animating: false,
-				// 父组件u-collapse的参数
-				parentData: {
-					accordion: false,
-					border: false
-				}
-			};
-		},
-		watch: {
-			expanded(n) {
-				clearTimeout(this.timer)
-				this.timer = null
-				// 这里根据expanded的值来进行一定的延时,是为了cell的下划线更好的显示效果
-				this.timer = setTimeout(() => {
-					this.showBorder = n
-				}, n ? 10 : 290)
-			}
-		},
-		mounted() {
-			this.init()
			console.log('$slots', this.$slots)
-		},
-		methods: {
-			// 异步获取内容,或者动态修改了内容时,需要重新初始化
-			async init() {
-				// 初始化数据
-				this.updateParentData()
-				if (!this.parent) {
-					return uni.$u.error('u-collapse-item必须要搭配u-collapse组件使用')
-				}
-				const {
-					value,
-					accordion,
-					children = []
-				} = this.parent
-
-				if (accordion) {
-					if (uni.$u.test.array(value)) {
-						return uni.$u.error('手风琴模式下,u-collapse组件的value参数不能为数组')
-					}
-					this.expanded = this.name == value
-				} else {
-					if (!uni.$u.test.array(value) && value !== null) {
-						return uni.$u.error('非手风琴模式下,u-collapse组件的value参数必须为数组')
-					}
-					this.expanded = (value || []).some(item => item == this.name)
-				}
-				// 设置组件的展开或收起状态
-				await nextTick()
-				this.setContentAnimate()
-			},
-			updateParentData() {
-				// 此方法在mixin中
-				this.getParentData('u-collapse')
-			},
-			async setContentAnimate() {
-				// 每次面板打开或者收起时,都查询元素尺寸
-				// 好处是,父组件从服务端获取内容后,变更折叠面板后可以获得最新的高度
-				const rect = await this.queryRect()
-				const height = this.expanded ? rect.height : 0
-				this.animating = true
-				// #ifdef APP-NVUE
-				const ref = this.$refs['animation'].ref
-				animation.transition(ref, {
-					styles: {
-						height: height + 'px'
-					},
-					duration: this.duration,
-					// 必须设置为true,否则会到面板收起或展开时,页面其他元素不会随之调整它们的布局
-					needLayout: true,
-					timingFunction: 'ease-in-out',
-				}, () => {
-					this.animating = false
-				})
-				// #endif
-
-				// #ifndef APP-NVUE
-				const animation = uni.createAnimation({
-					timingFunction: 'ease-in-out',
-				});
-				animation
-					.height(height)
-					.step({
-						duration: this.duration,
-					})
-					.step()
-				// 导出动画数据给面板的animationData值
-				this.animationData = animation.export()
-				// 标识动画结束
-				uni.$u.sleep(this.duration).then(() => {
-					this.animating = false
-				})
-				// #endif
-			},
-			// 点击collapsehead头部
-			clickHandler() {
-				if (this.disabled && this.animating) return
-				// 设置本组件为相反的状态
-				this.parent && this.parent.onChange(this)
-			},
-			// 查询内容高度
-			queryRect() {
-				// #ifndef APP-NVUE
-				// $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://ijry.github.io/uview-plus/js/getRect.html
-				// 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同
-				return new Promise(resolve => {
-					this.$uGetRect(`#${this.elId}`).then(size => {
-						resolve(size)
-					})
-				})
-				// #endif
-
-				// #ifdef APP-NVUE
-				// nvue下,使用dom模块查询元素高度
-				// 返回一个promise,让调用此方法的主体能使用then回调
-				return new Promise(resolve => {
-					dom.getComponentRect(this.$refs[this.elId], res => {
-						resolve(res.size)
-					})
-				})
-				// #endif
-			}
-		},
-	};
-</script>
-
-<style lang="scss" scoped>
-	@import "../../libs/css/components.scss";
-
-	.u-collapse-item {
-
-		&__content {
-			overflow: hidden;
-			height: 0;
-
-			&__text {
-				padding: 12px 15px;
-				color: $u-content-color;
-				font-size: 14px;
-				line-height: 18px;
-			}
-		}
-	}
-</style>
+<template>
+	<view class="u-collapse-item">
+		<u-cell
+			:title="$slots.title ? '' : title"
+			:value="value"
+			:label="label"
+			:icon="icon"
+			:isLink="isLink"
+			:clickable="clickable"
+			:border="parentData.border && showBorder"
+			@click="clickHandler"
+			:arrowDirection="expanded ? 'up' : 'down'"
+			:disabled="disabled"
+		>
+			<!-- 微信小程序不支持,因为微信中不支持 <slot name="title" #title />的写法 -->
+			<template #title>
+				<slot name="title">
+					<text v-if="!$slots.title && title">
+						{{title}}
+					</text>
+				</slot>
+			</template>
+			<template #icon>
+				<slot name="icon">
+					<u-icon v-if="!$slots.icon && icon" :size="22" :name="icon"></u-icon>
+				</slot>
+			</template>
+			<template #value>
+				<slot name="value">
+					<text v-if="!$slots.value && value">
+						{{value}}
+					</text>
+				</slot>
+			</template>
+			<template #right-icon>
+				<u-icon v-if="!$slots['right-icon']" :size="16" name="arrow-right"></u-icon>
+				<slot name="right-icon">
+				</slot>
+			</template>
+		</u-cell>
+		<view
+			class="u-collapse-item__content"
+			:animation="animationData"
+			ref="animation"
+		>
+			<view
+				class="u-collapse-item__content__text content-class"
+				:id="elId"
+				:ref="elId"
+			><slot /></view>
+		</view>
+		<u-line v-if="parentData.border"></u-line>
+	</view>
+</template>
+
+<script>
+	import props from './props.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { nextTick } from 'vue';
+	import { guid, sleep, error } from '../../libs/function/index';
+	import test from '../../libs/function/test';
+	// #ifdef APP-NVUE
+	const animation = uni.requireNativePlugin('animation')
+	const dom = uni.requireNativePlugin('dom')
+	// #endif
+	/**
+	 * collapseItem 折叠面板Item
+	 * @description 通过折叠面板收纳内容区域(搭配u-collapse使用)
+	 * @tutorial https://ijry.github.io/uview-plus/components/collapse.html
+	 * @property {String}			title 		标题
+	 * @property {String}			value 		标题右侧内容
+	 * @property {String}			label 		标题下方的描述信息
+	 * @property {Boolean}			disbled 	是否禁用折叠面板 ( 默认 false )
+	 * @property {Boolean}			isLink 		是否展示右侧箭头并开启点击反馈 ( 默认 true )
+	 * @property {Boolean}			clickable	是否开启点击反馈 ( 默认 true )
+	 * @property {Boolean}			border		是否显示内边框 ( 默认 true )
+	 * @property {String}			align		标题的对齐方式 ( 默认 'left' )
+	 * @property {String | Number}	name		唯一标识符
+	 * @property {String}			icon		标题左侧图片,可为绝对路径的图片或内置图标
+	 * @event {Function}			change 			某个item被打开或者收起时触发
+	 * @example <u-collapse-item :title="item.head" v-for="(item, index) in itemList" :key="index">{{item.body}}</u-collapse-item>
+	 */
+	export default {
+		name: "u-collapse-item",
+		mixins: [mpMixin, mixin, props],
+		data() {
+			return {
+				elId: guid(),
+				// uni.createAnimation的导出数据
+				animationData: {},
+				// 是否展开状态
+				expanded: false,
+				// 根据expanded确定是否显示border,为了控制展开时,cell的下划线更好的显示效果,进行一定时间的延时
+				showBorder: false,
+				// 是否动画中,如果是则不允许继续触发点击
+				animating: false,
+				// 父组件u-collapse的参数
+				parentData: {
+					accordion: false,
+					border: false
+				}
+			};
+		},
+		watch: {
+			expanded(n) {
+				clearTimeout(this.timer)
+				this.timer = null
+				// 这里根据expanded的值来进行一定的延时,是为了cell的下划线更好的显示效果
+				this.timer = setTimeout(() => {
+					this.showBorder = n
+				}, n ? 10 : 290)
+			}
+		},
+		mounted() {
+			this.init()
+			// console.log('$slots', this.$slots)
+		},
+		methods: {
+			// 异步获取内容,或者动态修改了内容时,需要重新初始化
+			async init() {
+				// 初始化数据
+				this.updateParentData()
+				if (!this.parent) {
+					return error('u-collapse-item必须要搭配u-collapse组件使用')
+				}
+				const {
+					value,
+					accordion,
+					children = []
+				} = this.parent
+
+				if (accordion) {
+					if (test.array(value)) {
+						return error('手风琴模式下,u-collapse组件的value参数不能为数组')
+					}
+					this.expanded = this.name == value
+				} else {
+					if (!test.array(value) && value !== null) {
+						return error('非手风琴模式下,u-collapse组件的value参数必须为数组')
+					}
+					this.expanded = (value || []).some(item => item == this.name)
+				}
+				// 设置组件的展开或收起状态
+				await nextTick()
+				this.setContentAnimate()
+			},
+			updateParentData() {
+				// 此方法在mixin中
+				this.getParentData('u-collapse')
+			},
+			async setContentAnimate() {
+				// 每次面板打开或者收起时,都查询元素尺寸
+				// 好处是,父组件从服务端获取内容后,变更折叠面板后可以获得最新的高度
+				const rect = await this.queryRect()
+				const height = this.expanded ? rect.height : 0
+				this.animating = true
+				// #ifdef APP-NVUE
+				const ref = this.$refs['animation'].ref
+				animation.transition(ref, {
+					styles: {
+						height: height + 'px'
+					},
+					duration: this.duration,
+					// 必须设置为true,否则会到面板收起或展开时,页面其他元素不会随之调整它们的布局
+					needLayout: true,
+					timingFunction: 'ease-in-out',
+				}, () => {
+					this.animating = false
+				})
+				// #endif
+
+				// #ifndef APP-NVUE
+				const animation = uni.createAnimation({
+					timingFunction: 'ease-in-out',
+				});
+				animation
+					.height(height)
+					.step({
+						duration: this.duration,
+					})
+					.step()
+				// 导出动画数据给面板的animationData值
+				this.animationData = animation.export()
+				// 标识动画结束
+				sleep(this.duration).then(() => {
+					this.animating = false
+				})
+				// #endif
+			},
+			// 点击collapsehead头部
+			clickHandler() {
+				if (this.disabled && this.animating) return
+				// 设置本组件为相反的状态
+				this.parent && this.parent.onChange(this)
+			},
+			// 查询内容高度
+			queryRect() {
+				// #ifndef APP-NVUE
+				// $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://ijry.github.io/uview-plus/js/getRect.html
+				// 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同
+				return new Promise(resolve => {
+					this.$uGetRect(`#${this.elId}`).then(size => {
+						resolve(size)
+					})
+				})
+				// #endif
+
+				// #ifdef APP-NVUE
+				// nvue下,使用dom模块查询元素高度
+				// 返回一个promise,让调用此方法的主体能使用then回调
+				return new Promise(resolve => {
+					dom.getComponentRect(this.$refs[this.elId], res => {
+						resolve(res.size)
+					})
+				})
+				// #endif
+			}
+		},
+	};
+</script>
+
+<style lang="scss" scoped>
+	@import "../../libs/css/components.scss";
+
+	.u-collapse-item {
+
+		&__content {
+			overflow: hidden;
+			height: 0;
+
+			&__text {
+				padding: 12px 15px;
+				color: $u-content-color;
+				font-size: 14px;
+				line-height: 18px;
+			}
+		}
+	}
+</style>

+ 3 - 3
src/uni_modules/uview-plus/components/u-collapse/u-collapse.vue

@@ -6,9 +6,9 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	/**
 	 * collapse 折叠面板 
 	 * @description 通过折叠面板收纳内容区域

+ 8 - 6
src/uni_modules/uview-plus/components/u-column-notice/u-column-notice.vue

@@ -57,9 +57,11 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, error } from '../../libs/function/index';
+	import test from '../../libs/function/test';
 	/**
 	 * ColumnNotice 滚动通知中的垂直滚动 内部组件
 	 * @description 该组件用于滚动通告场景,是其中的垂直滚动方式
@@ -82,8 +84,8 @@
 			text: {
 				immediate: true,
 				handler(newValue, oldValue) {
-					if(!uni.$u.test.array(newValue)) {
-						uni.$u.error('noticebar组件direction为column时,要求text参数为数组形式')
+					if(!test.array(newValue)) {
+						error('noticebar组件direction为column时,要求text参数为数组形式')
 					}
 				}
 			}
@@ -93,7 +95,7 @@
 			textStyle() {
 				let style = {}
 				style.color = this.color
-				style.fontSize = uni.$u.addUnit(this.fontSize)
+				style.fontSize = addUnit(this.fontSize)
 				return style
 			},
 			// 垂直或者水平滚动

+ 3 - 3
src/uni_modules/uview-plus/components/u-count-down/u-count-down.vue

@@ -7,9 +7,9 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	import {
 		isSameSecond,
 		parseFormat,

+ 6 - 4
src/uni_modules/uview-plus/components/u-count-to/u-count-to.vue

@@ -2,7 +2,7 @@
 	<text
 		class="u-count-num"
 		:style="{
-			fontSize: $u.addUnit(fontSize),
+			fontSize: addUnit(fontSize),
 			fontWeight: bold ? 'bold' : 'normal',
 			color: color
 		}"
@@ -10,9 +10,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+import props from './props';
+import mpMixin from '../../libs/mixin/mpMixin';
+import mixin from '../../libs/mixin/mixin';
+import { addUnit } from '../../libs/function/index';
 /**
  * countTo 数字滚动
  * @description 该组件一般用于需要滚动数字到某一个值的场景,目标要求是一个递增的值。
@@ -66,6 +67,7 @@ export default {
 	},
 	emits: ["end"],
 	methods: {
+		addUnit,
 		easingFn(t, b, c, d) {
 			return (c * (-Math.pow(2, (-10 * t) / d) + 1) * 1024) / 1023 + b;
 		},

+ 33 - 24
src/uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.vue

@@ -1,5 +1,5 @@
 <template>
-    <view v-if="hasInput">
+    <view v-if="hasInput" class="u-datetime-picker">
         <u-input
             :placeholder="placeholder"
             border="surround"
@@ -39,12 +39,12 @@
 	    }
 	    return result
 	}
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-	// import dayjs from '../../libs/util/dayjs.js';
-	import dayjs from 'dayjs/esm/index'
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import dayjs from 'dayjs/esm/index';
+	import { range, error, padZero } from '../../libs/function/index';
+	import test from '../../libs/function/test';
 	/**
 	 * DatetimePicker 时间日期选择器
 	 * @description 此选择器用于时间日期
@@ -99,12 +99,13 @@
 			// #ifdef VUE3
 			modelValue(newValue) {
 				this.init()
-				this.getInputValue()
+				// this.getInputValue(newValue)
 			},
 			// #endif
 			// #ifdef VUE2
 			value(newValue) {
 				this.init()
+				// this.getInputValue(newValue)
 			},
 			// #endif
 			propsChange() {
@@ -125,6 +126,10 @@
 		// #endif
 		methods: {
 			getInputValue(newValue) {
+				if (newValue == '' || !newValue || newValue == undefined) {
+					this.inputValue = ''
+					return
+				}
 				if (this.mode == 'time') {
 					this.inputValue = newValue
 				} else {
@@ -160,6 +165,9 @@
 				this.innerValue = this.correctValue(this.value)
 				// #endif
 				this.updateColumnValue(this.innerValue)
+
+				// 初始化hasInput展示
+				this.getInputValue(this.innerValue)
 			},
 			// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
 			setFormatter(e) {
@@ -201,12 +209,12 @@
 				let judge = e.match(/\d+/g)
 				//判断是否掺杂数字
 				if(judge.length>1){
-					uni.$u.error("请勿在过滤或格式化函数时添加数字")
+					error("请勿在过滤或格式化函数时添加数字")
 					return 0
 				}else if(type&&judge[0].length==4){//判断是否是年份
 					return judge[0]
 				}else if(judge[0].length>2){
-					uni.$u.error("请勿在过滤或格式化函数时添加数字")
+					error("请勿在过滤或格式化函数时添加数字")
 					return 0
 				}else{
 					return judge[0]
@@ -249,7 +257,7 @@
 					value: selectValue,
 					// #ifndef MP-WEIXIN
 					// 微信小程序不能传递this实例,会因为循环引用而报错
-					picker: this.$refs.picker,
+					// picker: this.$refs.picker,
 					// #endif
 					mode: this.mode
 				})
@@ -257,18 +265,16 @@
 			// 更新各列的值,进行补0、格式化等操作
 			updateColumnValue(value) {
 				this.innerValue = value
-        this.updateColumns()
-        // 延迟执行,等待u-picker组件列数据更新完后再设置选中值索引
-        setTimeout(() => {
-          this.updateIndexs(value)
-        }, 0);
-
+				this.updateColumns()
+				// 延迟执行,等待u-picker组件列数据更新完后再设置选中值索引
+				setTimeout(() => {
+				this.updateIndexs(value)
+				}, 0);
 			},
 			// 更新索引
 			updateIndexs(value) {
 				let values = []
 				const formatter = this.formatter || this.innerFormatter
-				const padZero = uni.$u.padZero
 				if (this.mode === 'time') {
 					// 将time模式的时间用:分隔成数组
 				    const timeArr = value.split(':')
@@ -310,7 +316,7 @@
 			    const results = this.getRanges().map(({ type, range }) => {
 			        let values = times(range[1] - range[0] + 1, (index) => {
 			            let value = range[0] + index
-			            value = type === 'year' ? `${value}` : uni.$u.padZero(value)
+			            value = type === 'year' ? `${value}` : padZero(value)
 			            return value
 			        })
 					// 进行过滤
@@ -335,20 +341,20 @@
 			// 得出合法的时间
 			correctValue(value) {
 				const isDateMode = this.mode !== 'time'
-				if (isDateMode && !uni.$u.test.date(value)) {
+				if (isDateMode && !test.date(value)) {
 					// 如果是日期类型,但是又没有设置合法的当前时间的话,使用最小时间为当前时间
 					value = this.minDate
 				} else if (!isDateMode && !value) {
 					// 如果是时间类型,而又没有默认值的话,就用最小时间
-					value = `${uni.$u.padZero(this.minHour)}:${uni.$u.padZero(this.minMinute)}`
+					value = `${padZero(this.minHour)}:${padZero(this.minMinute)}`
 				}
 				// 时间类型
 				if (!isDateMode) {
-					if (String(value).indexOf(':') === -1) return uni.$u.error('时间错误,请传递如12:24的格式')
+					if (String(value).indexOf(':') === -1) return error('时间错误,请传递如12:24的格式')
 					let [hour, minute] = value.split(':')
 					// 对时间补零,同时控制在最小值和最大值之间
-					hour = uni.$u.padZero(uni.$u.range(this.minHour, this.maxHour, Number(hour)))
-					minute = uni.$u.padZero(uni.$u.range(this.minMinute, this.maxMinute, Number(minute)))
+					hour = padZero(range(this.minHour, this.maxHour, Number(hour)))
+					minute = padZero(range(this.minMinute, this.maxMinute, Number(minute)))
 					return `${ hour }:${ minute }`
 				} else {
 					// 如果是日期格式,控制在最小日期和最大日期之间
@@ -444,4 +450,7 @@
 
 <style lang="scss" scoped>
 	@import '../../libs/css/components.scss';
+	.u-datetime-picker {
+		width: 100%;
+	}
 </style>

+ 7 - 5
src/uni_modules/uview-plus/components/u-divider/u-divider.vue

@@ -1,7 +1,7 @@
 <template>
 	<view
 	    class="u-divider"
-	    :style="[$u.addStyle(customStyle)]"
+	    :style="[addStyle(customStyle)]"
 		@tap="click"
 	>
 		<u-line
@@ -29,9 +29,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, addUnit } from '../../libs/function/index';
 	/**
 	 * divider 分割线
 	 * @description 区隔内容的分割线,一般用于页面底部"没有更多"的提示。
@@ -55,7 +56,7 @@
 		computed: {
 			textStyle() {
 				const style = {}
-				style.fontSize = uni.$u.addUnit(this.textSize)
+				style.fontSize = addUnit(this.textSize)
 				style.color = this.textColor
 				return style
 			},
@@ -84,6 +85,7 @@
 		},
 		emits: ["click"],
 		methods: {
+			addStyle,
 			// divider组件被点击时触发
 			click() {
 				this.$emit('click');

+ 7 - 5
src/uni_modules/uview-plus/components/u-dropdown-item/u-dropdown-item.vue

@@ -2,7 +2,7 @@
 	<view class="u-dropdown-item" v-if="active" @touchmove.stop.prevent="() => {}" @tap.stop.prevent="() => {}">
 		<block v-if="!$slots.default && !$slots.$default">
 			<scroll-view class="u-dropdown-item__scroll" scroll-y="true" :style="{
-				height: $u.addUnit(height)
+				height: addUnit(height)
 			}">
 				<view class="u-dropdown-item__options">
 					<up-cell-group>
@@ -21,9 +21,10 @@
 </template>
 
 <script>
-    import props from './props.js';
-    import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+    import props from './props';
+    import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, $parent } from '../../libs/function/index';
 	/**
 	 * dropdown-item 下拉菜单
 	 * @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
@@ -68,9 +69,10 @@
 		},
         emits: ['update:modelValue', 'change'],
 		methods: {
+			addUnit,
 			init() {
 				// 获取父组件u-dropdown
-				let parent = this.$u.$parent.call(this, 'u-dropdown');
+				let parent = $parent.call(this, 'u-dropdown');
 				if (parent) {
 					this.parent = parent;
 					// 将子组件的激活颜色配置为父组件设置的激活和未激活时的颜色

+ 12 - 10
src/uni_modules/uview-plus/components/u-dropdown/u-dropdown.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="u-dropdown">
 		<view class="u-dropdown__menu" :style="{
-			height: $u.addUnit(height)
+			height: addUnit(height)
 		}" :class="{
 			'u-border-bottom': borderBottom
 		}">
@@ -9,19 +9,19 @@
 				<view class="u-flex u-flex-row">
 					<text class="u-dropdown__menu__item__text" :style="{
 						color: item.disabled ? '#c0c4cc' : (index === current || highlightIndex == index) ? activeColor : inactiveColor,
-						fontSize: $u.addUnit(titleSize)
+						fontSize: addUnit(titleSize)
 					}">{{item.title}}</text>
 					<view class="u-dropdown__menu__item__arrow" :class="{
 						'u-dropdown__menu__item__arrow--rotate': index === current
 					}">
-						<u-icon :custom-style="{display: 'flex'}" :name="menuIcon" :size="$u.addUnit(menuIconSize)" :color="index === current || highlightIndex == index ? activeColor : '#c0c4cc'"></u-icon>
+						<u-icon :custom-style="{display: 'flex'}" :name="menuIcon" :size="addUnit(menuIconSize)" :color="index === current || highlightIndex == index ? activeColor : '#c0c4cc'"></u-icon>
 					</view>
 				</view>
 			</view>
 		</view>
 		<view class="u-dropdown__content" :style="[contentStyle, {
 			transition: `opacity ${duration / 1000}s linear`,
-			top: $u.addUnit(height),
+			top: addUnit(height),
 			height: contentHeight + 'px'
 		}]"
 		 @tap="maskClick" @touchmove.stop.prevent>
@@ -34,9 +34,10 @@
 </template>
 
 <script>
-    import props from './props.js';
-    import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+    import props from './props';
+    import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, sys} from '../../libs/function/index';
 	/**
 	 * dropdown 下拉菜单
 	 * @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
@@ -82,7 +83,7 @@
 				// 进行Y轴位移,展开状态时,恢复原位。收齐状态时,往上位移100%,进行隐藏
 				style.transform = `translateY(${this.active ? 0 : '-100%'})`
 				style['transition-duration'] = this.duration / 1000 + 's';
-				style.borderRadius = `0 0 ${this.$u.addUnit(this.borderRadius)} ${this.$u.addUnit(this.borderRadius)}`;
+				style.borderRadius = `0 0 ${addUnit(this.borderRadius)} ${addUnit(this.borderRadius)}`;
 				return style;
 			}
 		},
@@ -95,6 +96,7 @@
 		},
         emits: ['open', 'close'],
 		methods: {
+			addUnit,
 			init() {
 				// 当某个子组件内容变化时,触发父组件的init,父组件再让每一个子组件重新初始化一遍
 				// 以保证数据的正确性
@@ -164,8 +166,8 @@
 			getContentHeight() {
 				// 这里的原理为,因为dropdown组件是相对定位的,它的下拉出来的内容,必须给定一个高度
 				// 才能让遮罩占满菜单一下,直到屏幕底部的高度
-				// this.$u.sys()为uView封装的获取设备信息的方法
-				let windowHeight = this.$u.sys().windowHeight;
+				// sys()为uview-plus封装的获取设备信息的方法
+				let windowHeight = sys().windowHeight;
 				this.$uGetRect('.u-dropdown__menu').then(res => {
 					// 这里获取的是dropdown的尺寸,在H5上,uniapp获取尺寸是有bug的(以前提出修复过,后来又出现了此bug,目前hx2.8.11版本)
 					// H5端bug表现为元素尺寸的top值为导航栏底部到到元素的上边沿的距离,但是元素的bottom值确是导航栏顶部到元素底部的距离

+ 12 - 8
src/uni_modules/uview-plus/components/u-empty/u-empty.vue

@@ -14,8 +14,8 @@
 		<image
 		    v-else
 		    :style="{
-				width: $u.addUnit(width),
-				height: $u.addUnit(height),
+				width: addUnit(width),
+				height: addUnit(height),
 			}"
 		    :src="icon"
 		    mode="widthFix"
@@ -31,9 +31,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, deepMerge } from '../../libs/function/index';
 	/**
 	 * empty 内容为空
 	 * @description 该组件用于需要加载内容,但是加载的第一页数据就为空,提示一个"没有内容"的场景, 我们精心挑选了十几个场景的图标,方便您使用。
@@ -83,21 +84,24 @@
 			// 组件样式
 			emptyStyle() {
 				const style = {}
-				style.marginTop = uni.$u.addUnit(this.marginTop)
+				style.marginTop = addUnit(this.marginTop)
 				// 合并customStyle样式,此参数通过mixin中的props传递
-				return uni.$u.deepMerge(uni.$u.addStyle(this.customStyle), style)
+				return deepMerge(addStyle(this.customStyle), style)
 			},
 			// 文本样式
 			textStyle() {
 				const style = {}
 				style.color = this.textColor
-				style.fontSize = uni.$u.addUnit(this.textSize)
+				style.fontSize = addUnit(this.textSize)
 				return style
 			},
 			// 判断icon是否图片路径
 			isSrc() {
 				return this.icon.indexOf('/') >= 0
 			}
+		},
+		methods: {
+			addUnit
 		}
 	}
 </script>

+ 18 - 12
src/uni_modules/uview-plus/components/u-form-item/u-form-item.vue

@@ -3,7 +3,7 @@
 		<view
 			class="u-form-item__body"
 			@tap="clickHandler"
-			:style="[$u.addStyle(customStyle), {
+			:style="[addStyle(customStyle), {
                 flexDirection: (labelPosition || parentData.labelPosition) === 'left' ? 'row' : 'column'
 			}]"
 		>
@@ -14,7 +14,7 @@
 					class="u-form-item__body__left"
 					v-if="required || leftIcon || label"
 					:style="{
-						width: $u.addUnit(labelWidth || parentData.labelWidth),
+						width: addUnit(labelWidth || parentData.labelWidth),
 						marginBottom: parentData.labelPosition === 'left' ? 0 : '5px',
 					}"
 				>
@@ -62,22 +62,25 @@
 				v-if="!!message && parentData.errorType === 'message'"
 				class="u-form-item__body__right__message"
 				:style="{
-					marginLeft:  $u.addUnit(parentData.labelPosition === 'top' ? 0 : (labelWidth || parentData.labelWidth))
+					marginLeft:  addUnit(parentData.labelPosition === 'top' ? 0 : (labelWidth || parentData.labelWidth))
 				}"
 			>{{ message }}</text>
 		</slot>
 		<u-line
 			v-if="borderBottom"
-			:color="message && parentData.errorType === 'border-bottom' ? $u.color.error : propsLine.color"
+			:color="message && parentData.errorType === 'border-bottom' ? color.error : propsLine.color"
 			:customStyle="`margin-top: ${message && parentData.errorType === 'message' ? '5px' : 0}`"
 		></u-line>
 	</view>
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import defProps from '../../libs/config/props.js';
+	import color from '../../libs/config/color';
+	import { addStyle, addUnit, getProperty, setProperty, error } from '../../libs/function/index';
 	/**
 	 * Form 表单
 	 * @description 此组件一般用于表单场景,可以配置Input输入框,Select弹出框,进行表单验证等。
@@ -112,13 +115,14 @@
 					labelWidth: 45,
 					// 错误提示方式
 					errorType: 'message'
-				}
+				},
+				color: color
 			}
 		},
 		// 组件创建完成时,将当前实例保存到u-form中
 		computed: {
 			propsLine() {
-				return uni.$u.props.line
+				return defProps.line
 			}
 		},
 		mounted() {
@@ -126,11 +130,13 @@
 		},
 		emits: ["click"],
 		methods: {
+			addStyle,
+			addUnit,
 			init() {
 				// 父组件的实例
 				this.updateParentData()
 				if (!this.parent) {
-					uni.$u.error('u-form-item需要结合u-form组件使用')
+					error('u-form-item需要结合u-form组件使用')
 				}
 			},
 			// 获取父组件的参数
@@ -145,9 +151,9 @@
 			// 清空当前的组件的校验结果,并重置为初始值
 			resetField() {
 				// 找到原始值
-				const value = uni.$u.getProperty(this.parent.originalModel, this.prop)
+				const value = getProperty(this.parent.originalModel, this.prop)
 				// 将u-form的model的prop属性链还原原始值
-				uni.$u.setProperty(this.parent.model, this.prop, value)
+				setProperty(this.parent.model, this.prop, value)
 				// 移除校验结果
 				this.message = null
 			},

+ 12 - 11
src/uni_modules/uview-plus/components/u-form/u-form.vue

@@ -6,9 +6,11 @@
 
 <script>
 	import props from "./props.js";
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	import Schema from "../../libs/util/async-validator";
+	import { toast, getProperty, setProperty, deepClone, error } from '../../libs/function/index';
+	import test from '../../libs/function/test';
 	// 去除警告信息
 	Schema.warning = function() {};
 	/**
@@ -65,7 +67,7 @@
 				immediate: true,
 				handler(n) {
 					if (!this.originalModel) {
-						this.originalModel = uni.$u.deepClone(n);
+						this.originalModel = deepClone(n);
 					}
 				},
 			},
@@ -93,7 +95,7 @@
 				// 判断是否有规则
 				if (Object.keys(rules).length === 0) return;
 				if (process.env.NODE_ENV === 'development' && Object.keys(this.model).length === 0) {
-					uni.$u.error('设置rules,model必须设置!如果已经设置,请刷新页面。');
+					error('设置rules,model必须设置!如果已经设置,请刷新页面。');
 					return;
 				};
 				this.formRules = rules;
@@ -109,8 +111,8 @@
 				// 历遍所有u-form-item,根据其prop属性,还原model的原始快照
 				this.children.map((child) => {
 					const prop = child?.prop;
-					const value = uni.$u.getProperty(this.originalModel, prop);
-					uni.$u.setProperty(this.model, prop, value);
+					const value = getProperty(this.originalModel, prop);
+					setProperty(this.model, prop, value);
 				});
 			},
 			// 清空校验结果
@@ -137,7 +139,7 @@
 						const childErrors = [];
 						if (value.includes(child.prop)) {
 							// 获取对应的属性,通过类似'a.b.c'的形式
-							const propertyVal = uni.$u.getProperty(
+							const propertyVal = getProperty(
 								this.model,
 								child.prop
 							);
@@ -154,7 +156,6 @@
 								child.prop
 								);
 							}
-							
 							// 如果不存在对应的规则,直接返回,否则校验器会报错
 							if (!rule) return;
 							// rule规则可为数组形式,也可为对象形式,此处拼接成为数组
@@ -175,7 +176,7 @@
 										[propertyName]: propertyVal,
 									},
 									(errors, fields) => {
-										if (uni.$u.test.array(errors)) {
+										if (test.array(errors)) {
 											errorsRes.push(...errors);
 											childErrors.push(...errors);
 										}
@@ -194,7 +195,7 @@
 			validate(callback) {
 				// 开发环境才提示,生产环境不会提示
 				if (process.env.NODE_ENV === 'development' && Object.keys(this.formRules).length === 0) {
-					uni.$u.error('未设置rules,请看文档说明!如果已经设置,请刷新页面。');
+					error('未设置rules,请看文档说明!如果已经设置,请刷新页面。');
 					return;
 				}
 				return new Promise((resolve, reject) => {
@@ -207,7 +208,7 @@
 						this.validateField(formItemProps, (errors) => {
 							if(errors.length) {
 								// 如果错误提示方式为toast,则进行提示
-								this.errorType === 'toast' && uni.$u.toast(errors[0].message)
+								this.errorType === 'toast' && toast(errors[0].message)
 								reject(errors)
 							} else {
 								resolve(true)

+ 3 - 3
src/uni_modules/uview-plus/components/u-gap/u-gap.vue

@@ -3,9 +3,9 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	import { addStyle, addUnit, deepMerge } from '../../libs/function/index.js';
 	/**
 	 * gap 间隔槽

+ 14 - 9
src/uni_modules/uview-plus/components/u-grid-item/u-grid-item.vue

@@ -1,6 +1,7 @@
 <template>
-	<!-- #ifndef APP-NVUE -->
-	<view
		v-if="parentData.col > 0"
+	<!-- #ifndef APP-NVUE -->
+	<view
+		v-if="parentData.col > 0"
 	    class="u-grid-item"
 	    hover-class="u-grid-item--hover-class"
 	    :hover-stay-time="200"
@@ -25,9 +26,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, deepMerge } from '../../libs/function/index';
 	/**
 	 * gridItem 提示
 	 * @description 宫格组件一般用于同时展示多个同类项目的场景,可以给宫格的项目设置徽标组件(badge),或者图标等,也可以扩展为左右滑动的轮播形式。搭配u-grid使用
@@ -49,7 +51,8 @@
 				},
 				// #ifdef APP-NVUE
 				width: 0, // nvue下才这么计算,vue下放到computed中,否则会因为延时造成闪烁
-				// #endif
				// #ifdef MP-TOUTIAO
+				// #endif
+				// #ifdef MP-TOUTIAO
 				width: '100%',
 				// #endif
 				classes: [], // 类名集合,用于判断是否显示右边和下边框
@@ -60,9 +63,11 @@
 		},
 		emits: ['click'],
 		//  微信小程序中 options 选项
-		// #ifdef MP-WEIXIN
		options: {
+		// #ifdef MP-WEIXIN
+		options: {
 		    virtualHost: true ,//将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等
-		},
		// #endif
+		},
+		// #endif
 		computed: {
 			// #ifndef APP-NVUE || MP-TOUTIAO
 			// vue下放到computed中,否则会因为延时造成闪烁
@@ -79,7 +84,7 @@
 					background: this.bgColor,
 					width: this.width
 				}
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		},
 		methods: {

+ 18 - 7
src/uni_modules/uview-plus/components/u-grid/u-grid.vue

@@ -9,9 +9,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, deepMerge } from '../../libs/function/index';
 	/**
 	 * grid 宫格布局
 	 * @description 宫格组件一般用于同时展示多个同类项目的场景,可以给宫格的项目设置徽标组件(badge),或者图标等,也可以扩展为左右滑动的轮播形式。
@@ -68,12 +69,16 @@
 					default:
 						style.justifyContent = 'flex-start';
 				};
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
+				return deepMerge(style, addStyle(this.customStyle));
 			}
 		},
-		emits: ['click'], // 防止事件执行两次
		// 20240409发现抖音小程序如果开启virtualHost会出现严重问题,几乎所有事件包括created等生命周期事件全部失效。
		// #ifdef MP-WEIXIN
		options: {
+		emits: ['click'], // 防止事件执行两次
+		// 20240409发现抖音小程序如果开启virtualHost会出现严重问题,几乎所有事件包括created等生命周期事件全部失效。
+		// #ifdef MP-WEIXIN
+		options: {
 		    // virtualHost: true ,//将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等
-		},
		// #endif
+		},
+		// #endif
 		methods: {
 			// 此方法由u-grid-item触发,用于在u-grid发出事件
 			childClick(name) {
@@ -97,6 +102,12 @@
 		justify-content: center;
 		@include flex;
 		flex-wrap: wrap;
-		align-items: center;
		// 在uni-app中应尽量避免使用flex布局以外的方式,因为nvue/uvue等方案都支持flex布局
		// 这里使用grid布局使用为目前20240409uni-app在抖音小程序开启virtualHost时有bug,存在事件失效问题。
		/* #ifdef MP-TOUTIAO */
		display: grid;
		grid-template-columns: repeat(v-bind(col), 1fr);
		/* #endif */
+		align-items: center;
+		// 在uni-app中应尽量避免使用flex布局以外的方式,因为nvue/uvue等方案都支持flex布局
+		// 这里使用grid布局使用为目前20240409uni-app在抖音小程序开启virtualHost时有bug,存在事件失效问题。
+		/* #ifdef MP-TOUTIAO */
+		display: grid;
+		grid-template-columns: repeat(v-bind(col), 1fr);
+		/* #endif */
 	}
 </style>

+ 21 - 19
src/uni_modules/uview-plus/components/u-icon/u-icon.vue

@@ -9,13 +9,13 @@
 		    v-if="isImg"
 		    :src="name"
 		    :mode="imgMode"
-		    :style="[imgStyle, $u.addStyle(customStyle)]"
+		    :style="[imgStyle, addStyle(customStyle)]"
 		></image>
 		<text
 		    v-else
 		    class="u-icon__icon"
 		    :class="uClasses"
-		    :style="[iconStyle, $u.addStyle(customStyle)]"
+		    :style="[iconStyle, addStyle(customStyle)]"
 		    :hover-class="hoverClass"
 		>{{icon}}</text>
 		<!-- 这里进行空字符串判断,如果仅仅是v-if="label",可能会出现传递0的时候,结果也无法显示 -->
@@ -24,11 +24,11 @@
 		    class="u-icon__label"
 		    :style="{
 			color: labelColor,
-			fontSize: $u.addUnit(labelSize),
-			marginLeft: labelPos == 'right' ? $u.addUnit(space) : 0,
-			marginTop: labelPos == 'bottom' ? $u.addUnit(space) : 0,
-			marginRight: labelPos == 'left' ? $u.addUnit(space) : 0,
-			marginBottom: labelPos == 'top' ? $u.addUnit(space) : 0,
+			fontSize: addUnit(labelSize),
+			marginLeft: labelPos == 'right' ? addUnit(space) : 0,
+			marginTop: labelPos == 'bottom' ? addUnit(space) : 0,
+			marginRight: labelPos == 'left' ? addUnit(space) : 0,
+			marginBottom: labelPos == 'top' ? addUnit(space) : 0,
 		}"
 		>{{ label }}</text>
 	</view>
@@ -48,11 +48,11 @@
 
 	// 引入图标名称,已经对应的unicode
 	import icons from './icons'
-	
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle } from '../../libs/function/index';
+	import config from '../../libs/config/config';
 	/**
 	 * icon 图标
 	 * @description 基于字体的图标集,包含了大多数常见场景的图标。
@@ -100,7 +100,7 @@
 					classes.push(this.customPrefix)
 				}
 				// 主题色,通过类配置
-				if (this.color && uni.$u.config.type.includes(this.color)) classes.push('u-icon__icon--' + this.color)
+				if (this.color && config.type.includes(this.color)) classes.push('u-icon__icon--' + this.color)
 				// 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别
 				// 故需将其拆成一个字符串的形式,通过空格隔开各个类名
 				//#ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU
@@ -111,14 +111,14 @@
 			iconStyle() {
 				let style = {}
 				style = {
-					fontSize: uni.$u.addUnit(this.size),
-					lineHeight: uni.$u.addUnit(this.size),
+					fontSize: addUnit(this.size),
+					lineHeight: addUnit(this.size),
 					fontWeight: this.bold ? 'bold' : 'normal',
 					// 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
-					top: uni.$u.addUnit(this.top)
+					top: addUnit(this.top)
 				}
 				// 非主题色值时,才当作颜色值
-				if (this.color && !uni.$u.config.type.includes(this.color)) style.color = this.color
+				if (this.color && !config.type.includes(this.color)) style.color = this.color
 
 				return style
 			},
@@ -129,8 +129,8 @@
 			imgStyle() {
 				let style = {}
 				// 如果设置width和height属性,则优先使用,否则使用size属性
-				style.width = this.width ? uni.$u.addUnit(this.width) : uni.$u.addUnit(this.size)
-				style.height = this.height ? uni.$u.addUnit(this.height) : uni.$u.addUnit(this.size)
+				style.width = this.width ? addUnit(this.width) : addUnit(this.size)
+				style.height = this.height ? addUnit(this.height) : addUnit(this.size)
 				return style
 			},
 			// 通过图标名,查找对应的图标
@@ -142,6 +142,8 @@
 			}
 		},
 		methods: {
+			addStyle,
+			addUnit,
 			clickHandler(e) {
 				this.$emit('click', this.index)
 				// 是否阻止事件冒泡

+ 18 - 16
src/uni_modules/uview-plus/components/u-image/u-image.vue

@@ -19,19 +19,19 @@
 				:lazy-load="lazyLoad"
 				class="u-image__image"
 				:style="{
-					borderRadius: shape == 'circle' ? '10000px' : $u.addUnit(radius),
-					width: $u.addUnit(width),
-					height: $u.addUnit(height)
+					borderRadius: shape == 'circle' ? '10000px' : addUnit(radius),
+					width: addUnit(width),
+					height: addUnit(height)
 				}"
 			></image>
 			<view
 				v-if="showLoading && loading"
 				class="u-image__loading"
 				:style="{
-					borderRadius: shape == 'circle' ? '50%' : $u.addUnit(radius),
+					borderRadius: shape == 'circle' ? '50%' : addUnit(radius),
 					backgroundColor: this.bgColor,
-					width: $u.addUnit(width),
-					height: $u.addUnit(height)
+					width: addUnit(width),
+					height: addUnit(height)
 				}"
 			>
 				<slot name="loading">
@@ -46,9 +46,9 @@
 				v-if="showError && isError && !loading"
 				class="u-image__error"
 				:style="{
-					borderRadius: shape == 'circle' ? '50%' : $u.addUnit(radius),
-					width: $u.addUnit(width),
-					height: $u.addUnit(height)
+					borderRadius: shape == 'circle' ? '50%' : addUnit(radius),
+					width: addUnit(width),
+					height: addUnit(height)
 				}"
 			>
 				<slot name="error">
@@ -64,9 +64,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, deepMerge } from '../../libs/function/index';
 	/**
 	 * Image 图片
 	 * @description 此组件为uni-app的image组件的加强版,在继承了原有功能外,还支持淡入动画、加载中、加载失败提示、圆角值和形状等。
@@ -131,10 +132,10 @@
 			wrapStyle() {
 				let style = {};
 				// 通过调用addUnit()方法,如果有单位,如百分比,px单位等,直接返回,如果是纯粹的数值,则加上rpx单位
-				style.width = this.$u.addUnit(this.width);
-				style.height = this.$u.addUnit(this.height);
+				style.width = addUnit(this.width);
+				style.height = addUnit(this.height);
 				// 如果是显示圆形,设置一个很多的半径值即可
-				style.borderRadius = this.shape == 'circle' ? '10000px' : uni.$u.addUnit(this.radius)
+				style.borderRadius = this.shape == 'circle' ? '10000px' : addUnit(this.radius)
 				// 如果设置圆角,必须要有hidden,否则可能圆角无效
 				style.overflow = this.radius > 0 ? 'hidden' : 'visible'
 				// if (this.fade) {
@@ -144,7 +145,7 @@
 				// 	style.transitionTimingFunction = 'ease-in-out'
 				// 	style.transitionProperty = 'opacity'
 				// }
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
+				return deepMerge(style, addStyle(this.customStyle));
 
 			}
 		},
@@ -153,6 +154,7 @@
 		},
 		emits: ['click', 'error', 'load'],
 		methods: {
+			addUnit,
 			// 点击图片
 			onClick() {
 				this.$emit('click')

+ 11 - 9
src/uni_modules/uview-plus/components/u-index-anchor/u-index-anchor.vue

@@ -6,14 +6,14 @@
 	    class="u-index-anchor u-border-bottom"
 		:ref="`u-index-anchor-${text}`"
 	    :style="{
-			height: $u.addUnit(height),
+			height: addUnit(height),
 			backgroundColor: bgColor
 		}"
 	>
 		<text
 		    class="u-index-anchor__text"
 		    :style="{
-				fontSize: $u.addUnit(size),
+				fontSize: addUnit(size),
 				color: color
 			}"
 		>{{ text }}</text>
@@ -24,9 +24,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, $parent, error } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	const dom = uni.requireNativePlugin('dom')
 	// #endif
@@ -52,19 +53,20 @@
 			this.init()
 		},
 		methods: {
+			addUnit,
 			init() {
 				// 此处会活动父组件实例,并赋值给实例的parent属性
-				const indexList = uni.$u.$parent.call(this, 'u-index-list')
+				const indexList = $parent.call(this, 'u-index-list')
 				if (!indexList) { 
-					return uni.$u.error('u-index-anchor必须要搭配u-index-list组件使用')
+					return error('u-index-anchor必须要搭配u-index-list组件使用')
 				}
 				// 将当前实例放入到u-index-list中
 				indexList.anchors.push(this)
-				const indexListItem = uni.$u.$parent.call(this, 'u-index-item')
+				const indexListItem = $parent.call(this, 'u-index-item')
 				// #ifndef APP-NVUE
 				// 只有在非nvue下,u-index-anchor才是嵌套在u-index-item中的
 				if (!indexListItem) {
-					return uni.$u.error('u-index-anchor必须要搭配u-index-item组件使用')
+					return error('u-index-anchor必须要搭配u-index-item组件使用')
 				}
 				// 设置u-index-item的id为anchor的text标识符,因为非nvue下滚动列表需要依赖scroll-view滚动到元素的特性
 				indexListItem.id = this.text.charCodeAt(0)

+ 6 - 5
src/uni_modules/uview-plus/components/u-index-item/u-index-item.vue

@@ -15,9 +15,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { sleep, error } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
 	const dom = uni.requireNativePlugin('dom')
@@ -53,9 +54,9 @@
 				// 此处会活动父组件实例,并赋值给实例的parent属性
 				this.getParentData('u-index-list')
 				if (!this.parent) {
-					return uni.$u.error('u-index-item必须要搭配u-index-list组件使用')
+					return error('u-index-item必须要搭配u-index-list组件使用')
 				}
-				uni.$u.sleep().then(() =>{
+				sleep().then(() =>{
 					this.getIndexItemRect().then(size => {
 						// 由于对象的引用特性,此处会同时生效到父组件的children数组的本实例的top属性中,供父组件判断读取
 						this.top = Math.ceil(size.top)

+ 24 - 21
src/uni_modules/uview-plus/components/u-index-list/u-index-list.vue

@@ -6,7 +6,7 @@
 			enable-back-to-top
 			:offset-accuracy="1"
 			:style="{
-				maxHeight: $u.addUnit(scrollViewHeight)
+				maxHeight: addUnit(scrollViewHeight)
 			}"
 			@scroll="scrollHandler"
 			ref="uList"
@@ -29,7 +29,7 @@
 			:scrollIntoView="scrollIntoView"
 			:offset-accuracy="1"
 			:style="{
-				maxHeight: $u.addUnit(scrollViewHeight)
+				maxHeight: addUnit(scrollViewHeight)
 			}"
 			scroll-y
 			@scroll="scrollHandler"
@@ -47,7 +47,7 @@
 		<view
 			class="u-index-list__letter"
 			ref="u-index-list__letter"
-			:style="{ top: $u.addUnit(letterInfo.top || 100) }"
+			:style="{ top: addUnit(letterInfo.top || 100) }"
 			@touchstart.prevent="touchStart"
 			@touchmove.prevent="touchMove"
 			@touchend.prevent="touchEnd"
@@ -73,7 +73,7 @@
 			:customStyle="{
 				position: 'fixed',
 				right: '50px',
-				top: $u.addUnit(indicatorTop),
+				top: addUnit(indicatorTop),
 				zIndex: 2
 			}"
 		>
@@ -81,8 +81,8 @@
 				class="u-index-list__indicator"
 				:class="['u-index-list__indicator--show']"
 				:style="{
-					height: $u.addUnit(indicatorHeight),
-					width: $u.addUnit(indicatorHeight)
+					height: addUnit(indicatorHeight),
+					width: addUnit(indicatorHeight)
 				}"
 			>
 				<text class="u-index-list__indicator__text">{{ uIndexList[activeIndex] }}</text>
@@ -100,9 +100,10 @@
 		}
 		return indexList;
 	}
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, sys, sleep, getPx } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
 	const dom = uni.requireNativePlugin('dom')
@@ -148,7 +149,7 @@
 				// scroll-view的高度
 				scrollViewHeight: 0,
 				// 系统信息
-				sys: uni.$u.sys(),
+				sys: sys(),
 				scrolling: false,
 				scrollIntoView: '',
 			}
@@ -172,7 +173,7 @@
 			uIndexList: {
 				immediate: true,
 				handler() {
-					uni.$u.sleep().then(() => {
+					sleep().then(() => {
 						this.setIndexListLetterInfo()
 					})
 				}
@@ -187,11 +188,12 @@
 			this.setIndexListLetterInfo()
 		},
 		methods: {
+			addUnit,
 			init() {
 				// 设置列表的高度为整个屏幕的高度
 				//减去this.customNavHeight,并将this.scrollViewHeight设置为maxHeight
 				//解决当u-index-list组件放在tabbar页面时,scroll-view内容较少时,还能滚动
-				let customNavHeight = uni.$u.getPx(this.customNavHeight)
+				let customNavHeight = getPx(this.customNavHeight)
 				this.scrollViewHeight = this.sys.windowHeight - customNavHeight
 			},
 			// 索引列表被触摸
@@ -226,7 +228,7 @@
 			// 触摸结束
 			touchEnd(e) {
 				// 延时一定时间后再隐藏指示器,为了让用户看的更直观,同时也是为了消除快速切换u-transition的show带来的影响
-				uni.$u.sleep(300).then(() => {
+				sleep(300).then(() => {
 					this.touching = false
 				})
 			},
@@ -254,20 +256,20 @@
 					const {
 						height
 					} = size
-					const sys = uni.$u.sys()
-					const windowHeight = sys.windowHeight
+					const sysData = sys()
+					const windowHeight = sysData.windowHeight
 					let customNavHeight = 0
 					// 消除各端导航栏非原生和原生导致的差异,让索引列表字母对屏幕垂直居中
 					if (this.customNavHeight == 0) {
 						// #ifdef H5
-						customNavHeight = sys.windowTop
+						customNavHeight = sysData.windowTop
 						// #endif
 						// #ifndef H5
 						// 在非H5中,为原生导航栏,其高度不算在windowHeight内,这里设置为负值,后面相加时变成减去其高度的一半
-						customNavHeight = -(sys.statusBarHeight + 44)
+						customNavHeight = -(sysData.statusBarHeight + 44)
 						// #endif
 					} else {
-						customNavHeight = uni.$u.getPx(this.customNavHeight)
+						customNavHeight = getPx(this.customNavHeight)
 					}
 					this.letterInfo = {
 						height,
@@ -286,7 +288,7 @@
 				} = this.letterInfo
 				// 对H5的pageY进行修正,这是由于uni-app自作多情在H5中将触摸点的坐标跟H5的导航栏结合导致的问题
 				// #ifdef H5
-				pageY += uni.$u.sys().windowTop
+				pageY += sys().windowTop
 				// #endif
 				// 对第一和最后一个字母做边界处理,因为用户可能在字母列表上触摸到两端的尽头后依然继续滑动
 				if (pageY < top) {
@@ -311,7 +313,7 @@
 				// #ifdef MP-WEIXIN
 				// 微信小程序下,scroll-view的scroll-into-view属性无法对slot中的内容的id生效,只能通过设置scrollTop的形式去移动滚动条
 				const customNavHeight = this.customNavHeight
-				this.scrollTop = this.children[currentIndex].top - uni.$u.getPx(customNavHeight)
+				this.scrollTop = this.children[currentIndex].top - getPx(customNavHeight)
 				// #endif
 				// #ifdef APP-NVUE
 				// 在nvue中,由于cell和header为同级元素,所以实际是需要对header(anchor)进行偏移
@@ -335,7 +337,7 @@
 				if (this.touching || this.scrolling) return
 				// 每过一定时间取样一次,减少资源损耗以及可能带来的卡顿
 				this.scrolling = true
-				uni.$u.sleep(10).then(() => {
+				sleep(10).then(() => {
 					this.scrolling = false
 				})
 				let scrollTop = 0
@@ -364,6 +366,7 @@
 				// 非nvue通过detail获取滚动条位移
 				scrollTop = e.detail.scrollTop
 				// #endif
+				scrollTop += getPx(this.customNavHeight)
 				for (let i = 0; i < len; i++) {
 					const item = children[i],
 						nextItem = children[i + 1]

+ 19 - 11
src/uni_modules/uview-plus/components/u-input/u-input.vue

@@ -77,8 +77,9 @@
 
 <script>
 import props from "./props.js";
-import mpMixin from '../../libs/mixin/mpMixin.js';
-import mixin from '../../libs/mixin/mixin.js';
+import mpMixin from '../../libs/mixin/mpMixin';
+import mixin from '../../libs/mixin/mixin';
+import { addStyle, addUnit, deepMerge, formValidate, $parent, sleep, os } from '../../libs/function/index';
 /**
  * Input 输入框
  * @description  此组件为一个输入框,默认没有边框和样式,是专门为配合表单组件u-form而设计的,利用它可以快速实现表单验证,输入内容,下拉选择等功能。
@@ -126,6 +127,8 @@ export default {
     mixins: [mpMixin, mixin, props],
     data() {
         return {
+            // 清除操作
+            clearInput: false,
             // 输入框的值
             innerValue: "",
             // 是否处于获得焦点状态
@@ -153,7 +156,7 @@ export default {
                     this.valueChange();
                 } else {
 					// 尝试调用u-form的验证方法
-					uni.$u.formValidate(this, "change");
+					formValidate(this, "change");
 				}
                 /* #endif */
                 this.firstChange = false;
@@ -176,7 +179,7 @@ export default {
                     this.valueChange();
                 } else {
 					// 尝试调用u-form的验证方法
-					uni.$u.formValidate(this, "change");
+					formValidate(this, "change");
 				}
                 /* #endif */
                 this.firstChange = false;
@@ -223,13 +226,13 @@ export default {
                 style.paddingLeft = "9px";
                 style.paddingRight = "9px";
             }
-            return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
+            return deepMerge(style, addStyle(this.customStyle));
         },
         // 输入框的样式
         inputStyle() {
             const style = {
                 color: this.color,
-                fontSize: uni.$u.addUnit(this.fontSize),
+                fontSize: addUnit(this.fontSize),
 				textAlign: this.inputAlign
             };
             return style;
@@ -261,11 +264,11 @@ export default {
             this.$emit("blur", event.detail.value);
             // H5端的blur会先于点击清除控件的点击click事件触发,导致focused
             // 瞬间为false,从而隐藏了清除控件而无法被点击到
-            uni.$u.sleep(150).then(() => {
+            sleep(150).then(() => {
                 this.focused = false;
             });
             // 尝试调用u-form的验证方法
-            uni.$u.formValidate(this, "blur");
+            formValidate(this, "blur");
         },
         // 输入框聚焦时触发
         onFocus(event) {
@@ -283,6 +286,10 @@ export default {
         },
         // 内容发生变化,进行处理
         valueChange() {
+            if(this.clearInput) {
+                this.innerValue = '';
+                this.clearInput = false;
+            }
             const value = this.innerValue;
             this.$nextTick(() => {
                 // #ifdef VUE3
@@ -295,11 +302,12 @@ export default {
                 this.changeFromInner = true;
                 this.$emit("change", value);
                 // 尝试调用u-form的验证方法
-                uni.$u.formValidate(this, "change");
+                formValidate(this, "change");
             });
         },
         // 点击清除控件
         onClear() {
+            this.clearInput = true;
             this.innerValue = "";
             this.$nextTick(() => {
                 this.valueChange();
@@ -313,8 +321,8 @@ export default {
          */
         clickHandler() {
             // #ifdef APP-NVUE
-            if (uni.$u.os() === "android") {
-                const formItem = uni.$u.$parent.call(this, "u-form-item");
+            if (os() === "android") {
+                const formItem = $parent.call(this, "u-form-item");
                 if (formItem) {
                     formItem.clickHandler();
                 }

+ 3 - 3
src/uni_modules/uview-plus/components/u-keyboard/u-keyboard.vue

@@ -68,9 +68,9 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 
 	/**
 	 * keyboard 键盘

+ 11 - 8
src/uni_modules/uview-plus/components/u-line-progress/u-line-progress.vue

@@ -1,14 +1,14 @@
 <template>
 	<view
 	    class="u-line-progress"
-	    :style="[$u.addStyle(customStyle)]"
+	    :style="[addStyle(customStyle)]"
 	>
 		<view
 		    class="u-line-progress__background"
 		    ref="u-line-progress__background"
 		    :style="[{
 				backgroundColor: inactiveColor,
-				height: $u.addUnit(height),
+				height: addUnit(height),
 			}]"
 		>
 		</view>
@@ -24,9 +24,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, sleep, range } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	const dom = uni.requireNativePlugin('dom')
 	// #endif
@@ -60,20 +61,22 @@
 				let style = {}
 				style.width = this.lineWidth
 				style.backgroundColor = this.activeColor
-				style.height = uni.$u.addUnit(this.height)
+				style.height = addUnit(this.height)
 				return style
 			},
 			innserPercentage() {
 				// 控制范围在0-100之间
-				return uni.$u.range(0, 100, this.percentage)
+				return range(0, 100, this.percentage)
 			}
 		},
 		mounted() {
 			this.init()
 		},
 		methods: {
+			addStyle,
+			addUnit,
 			init() {
-				uni.$u.sleep(20).then(() => {
+				sleep(20).then(() => {
 					this.resizeProgressWidth()
 				})
 			},

+ 7 - 6
src/uni_modules/uview-plus/components/u-line/u-line.vue

@@ -8,9 +8,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, deepMerge } from '../../libs/function/index';
 	/**
 	 * line 线条
 	 * @description 此组件一般用于显示一根线条,用于分隔内容块,有横向和竖向两种模式,且能设置0.5px线条,使用也很简单
@@ -36,18 +37,18 @@
 					// 此处采用兼容分开写,兼容nvue的写法
 					style.borderBottomWidth = '1px'
 					style.borderBottomStyle = this.dashed ? 'dashed' : 'solid'
-					style.width = uni.$u.addUnit(this.length)
+					style.width = addUnit(this.length)
 					if (this.hairline) style.transform = 'scaleY(0.5)'
 				} else {
 					// 如果是竖向线条,边框宽度为1px,再通过transform缩小一半,就是0.5px了
 					style.borderLeftWidth = '1px'
 					style.borderLeftStyle = this.dashed ? 'dashed' : 'solid'
-					style.height = uni.$u.addUnit(this.length)
+					style.height = addUnit(this.length)
 					if (this.hairline) style.transform = 'scaleX(0.5)'
 				}
 
 				style.borderColor = this.color
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		}
 	}

+ 9 - 8
src/uni_modules/uview-plus/components/u-link/u-link.vue

@@ -2,15 +2,15 @@
 	<text
 	    class="u-link"
 	    @tap.stop="openLink"
-	    :style="[linkStyle, $u.addStyle(customStyle)]"
+	    :style="[linkStyle, addStyle(customStyle)]"
 	>{{text}}</text>
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, addUnit, getPx, toast } from '../../libs/function/index';
 	/**
 	 * link 超链接
 	 * @description 该组件为超链接组件,在不同平台有不同表现形式:在APP平台会通过plus环境打开内置浏览器,在小程序中把链接复制到粘贴板,同时提示信息,在H5中通过window.open打开链接。
@@ -33,9 +33,9 @@
 			linkStyle() {
 				const style = {
 					color: this.color,
-					fontSize: uni.$u.addUnit(this.fontSize),
+					fontSize: addUnit(this.fontSize),
 					// line-height设置为比字体大小多2px
-					lineHeight: uni.$u.addUnit(uni.$u.getPx(this.fontSize) + 2),
+					lineHeight: addUnit(getPx(this.fontSize) + 2),
 					textDecoration: this.underLine ? 'underline' : 'none'
 				}
 				// if (this.underLine) {
@@ -47,6 +47,7 @@
 		},
 		emits: ["click"],
 		methods: {
+			addStyle,
 			openLink() {
 				// #ifdef APP-PLUS
 				plus.runtime.openURL(this.href)
@@ -60,7 +61,7 @@
 					success: () => {
 						uni.hideToast();
 						this.$nextTick(() => {
-							uni.$u.toast(this.mpTips);
+							toast(this.mpTips);
 						})
 					}
 				});

+ 5 - 4
src/uni_modules/uview-plus/components/u-list-item/u-list-item.vue

@@ -16,9 +16,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { sys } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	const dom = uni.requireNativePlugin('dom')
 	// #endif
@@ -38,7 +39,7 @@
 				rect: {},
 				index: 0,
 				show: true,
-				sys: uni.$u.sys()
+				sys: sys()
 			}
 		},
 		computed: {

+ 26 - 3
src/uni_modules/uview-plus/components/u-list/props.js

@@ -70,8 +70,31 @@ export default {
         preLoadScreen: {
             type: [String, Number],
             default: () => defProps.list.preLoadScreen
-        }
-        // vue下,是否开启虚拟列表
-
+        },
+        // 开启自定义下拉刷新
+        refresherEnabled: {
+            type: Boolean,
+            default: () => false
+        },
+        // 设置自定义下拉刷新阈值	
+        refresherThreshold: {
+            type: Number,
+            default: () => 45
+        },
+        // 设置自定义下拉刷新默认样式,支持设置 black,white,none,none 表示不使用默认样式
+        refresherDefaultStyle: {
+            type: String,
+            default: () => 'black'
+        },
+        // 设置自定义下拉刷新区域背景颜色
+        refresherBackground: {
+            type: String,
+            default: () => '#FFF'
+        },
+        // 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
+        refresherTriggered: {
+            type: Boolean,
+            default: () => false
+        },
     }
 }

+ 33 - 10
src/uni_modules/uview-plus/components/u-list/u-list.vue

@@ -28,6 +28,16 @@
 		@scroll="onScroll"
 		@scrolltolower="scrolltolower"
 		@scrolltoupper="scrolltoupper"
+		:refresher-enabled="refresherEnabled"
+		:refresher-threshold="refresherThreshold"
+		:refresher-default-style="refresherDefaultStyle"
+		:refresher-background="refresherBackground"
+		:refresher-triggered="refresherTriggered"
+		@refresherpulling="refresherpulling"
+		@refresherrefresh="refresherrefresh"
+		@refresherrestore="refresherrestore"
+		@refresherabort="refresherabort"
+		:scroll-anchoring="true"
 	>
 		<view>
 			<slot />
@@ -37,9 +47,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, deepMerge, sleep, sys } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	const dom = uni.requireNativePlugin('dom')
 	// #endif
@@ -79,18 +90,17 @@
 				innerScrollTop: 0,
 				// vue下,scroll-view在上拉加载时的偏移值
 				offset: 0,
-				sys: uni.$u.sys()
+				sys: sys()
 			}
 		},
 		computed: {
 			listStyle() {
-				const style = {},
-					addUnit = uni.$u.addUnit
+				const style = {};
 				if (this.width != 0) style.width = addUnit(this.width)
 				if (this.height != 0) style.height = addUnit(this.height)
 				// 如果没有定义列表高度,则默认使用屏幕高度
 				if (!style.height) style.height = addUnit(this.sys.windowHeight, 'px')
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		},
 		provide() {
@@ -104,7 +114,8 @@
 			this.anchors = []
 		},
 		mounted() {},
-		emits: ["scroll", "scrolltolower", "scrolltoupper"],
+		emits: ["scroll", "scrolltolower", "scrolltoupper",
+			"refresherpulling", "refresherrefresh", "refresherrestore", "refresherabort"],
 		methods: {
 			updateOffsetFromChild(top) {
 				this.offset = top
@@ -132,18 +143,30 @@
 			},
 			// 滚动到底部触发事件
 			scrolltolower(e) {
-				uni.$u.sleep(30).then(() => {
+				sleep(30).then(() => {
 					this.$emit('scrolltolower')
 				})
 			},
 			// #ifndef APP-NVUE
 			// 滚动到底部时触发,非nvue有效
 			scrolltoupper(e) {
-				uni.$u.sleep(30).then(() => {
+				sleep(30).then(() => {
 					this.$emit('scrolltoupper')
 					// 这一句很重要,能绝对保证在性功能障碍的webview,滚动条到顶时,取消偏移值,让页面置顶
 					this.offset = 0
 				})
+			},
+			refresherpulling(e) {
+				this.$emit('refresherpulling', e)
+			},
+			refresherrefresh(e) {
+				this.$emit('refresherrefresh', e)
+			},
+			refresherrestore(e) {
+				this.$emit('refresherrestore', e)
+			},
+			refresherabort(e) {
+				this.$emit('refresherabort', e)
 			}
 			// #endif
 		},

+ 15 - 13
src/uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.vue

@@ -1,7 +1,7 @@
 <template>
 	<view
 		class="u-loading-icon"
-		:style="[$u.addStyle(customStyle)]"
+		:style="[addStyle(customStyle)]"
 		:class="[vertical && 'u-loading-icon--vertical']"
 		v-if="show"
 	>
@@ -12,8 +12,8 @@
 			ref="ani"
 			:style="{
 				color: color,
-				width: $u.addUnit(size),
-				height: $u.addUnit(size),
+				width: addUnit(size),
+				height: addUnit(size),
 				borderTopColor: color,
 				borderBottomColor: otherBorderColor,
 				borderLeftColor: otherBorderColor,
@@ -39,8 +39,8 @@
 					:animating="true"
 					:style="{
 						color: color,
-						width: $u.addUnit(size),
-						height: $u.addUnit(size)
+						width: addUnit(size),
+						height: addUnit(size)
 					}"
 				/>
 				<!-- #endif -->
@@ -50,7 +50,7 @@
 			v-if="text"
 			class="u-loading-icon__text"
 			:style="{
-				fontSize: $u.addUnit(textSize),
+				fontSize: addUnit(textSize),
 				color: textColor,
 			}"
 		>{{text}}</text>
@@ -58,9 +58,11 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle } from '../../libs/function/index';
+	import { colorGradient } from '../../libs/function/colorGradient';
 	// #ifdef APP-NVUE
 	const animation = weex.requireModule('animation');
 	// #endif
@@ -104,7 +106,7 @@
 			// 之所以需要这么做的原因是,比如父组件传了color为红色,那么需要另外的三个边为浅红色
 			// 而不能是固定的某一个其他颜色(因为这个固定的颜色可能浅蓝,导致效果没有那么细腻良好)
 			otherBorderColor() {
-				const lightColor = uni.$u.colorGradient(this.color, '#ffffff', 100)[80]
+				const lightColor = colorGradient(this.color, '#ffffff', 100)[80]
 				if (this.mode === 'circle') {
 					return this.inactiveColor ? this.inactiveColor : lightColor
 				} else {
@@ -129,6 +131,8 @@
 			this.init()
 		},
 		methods: {
+			addUnit,
+			addStyle,
 			init() {
 				setTimeout(() => {
 					// #ifdef APP-NVUE
@@ -230,9 +234,7 @@
 	$u-loading-icon-dot-before-border-radius:40% !default;
 
 	.u-loading-icon {
-		/* #ifndef APP-NVUE */
-		// display: inline-flex;
-		/* #endif */
+		display: flex;
 		flex-direction: row;
 		align-items: center;
 		justify-content: center;

+ 10 - 7
src/uni_modules/uview-plus/components/u-loading-page/u-loading-page.vue

@@ -20,14 +20,14 @@
                         class="u-loading-page__warpper__loading-icon__img"
                         mode="widthFit"
 						:style="{
-							width: $u.addUnit(iconSize),
-						    height: $u.addUnit(iconSize)
+							width: addUnit(iconSize),
+						    height: addUnit(iconSize)
 						}"
                     ></image>
                     <u-loading-icon
                         v-else
                         :mode="loadingMode"
-                        :size="$u.addUnit(iconSize)"
+                        :size="addUnit(iconSize)"
                         :color="loadingColor"
                     ></u-loading-icon>
                 </view>
@@ -35,7 +35,7 @@
                     <text
                         class="u-loading-page__warpper__text"
                         :style="{
-                            fontSize: $u.addUnit(fontSize),
+                            fontSize: addUnit(fontSize),
                             color: color,
                         }"
                         >{{ loadingText }}</text
@@ -48,8 +48,9 @@
 
 <script>
 import props from "./props.js";
-import mpMixin from '../../libs/mixin/mpMixin.js';
-import mixin from '../../libs/mixin/mixin.js';
+import mpMixin from '../../libs/mixin/mpMixin';
+import mixin from '../../libs/mixin/mixin';
+import { addUnit } from '../../libs/function/index';
 /**
  * loadingPage 加载动画
  * @description 警此组件为一个小动画,目前用在uView的loadmore加载更多和switch开关等组件的正在加载状态场景。
@@ -72,7 +73,9 @@ export default {
     data() {
         return {};
     },
-    methods: {},
+    methods: {
+        addUnit
+    }
 };
 </script>
 

+ 12 - 10
src/uni_modules/uview-plus/components/u-loadmore/u-loadmore.vue

@@ -2,12 +2,12 @@
 	<view
 	    class="u-loadmore"
 	    :style="[
-			$u.addStyle(customStyle),
+			addStyle(customStyle),
 			{
 				backgroundColor: bgColor,
-				marginBottom: $u.addUnit(marginBottom),
-				marginTop: $u.addUnit(marginTop),
-				height: $u.addUnit(height),
+				marginBottom: addUnit(marginBottom),
+				marginTop: addUnit(marginTop),
+				height: addUnit(height),
 			},
 		]"
 	>
@@ -52,10 +52,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle } from '../../libs/function/index';
 	/**
 	 * loadmore 加载更多
 	 * @description 此组件一般用于标识页面底部加载数据时的状态。
@@ -95,8 +95,8 @@
 			loadTextStyle() {
 				return {
 					color: this.color,
-					fontSize: uni.$u.addUnit(this.fontSize),
-					lineHeight: uni.$u.addUnit(this.fontSize),
+					fontSize: addUnit(this.fontSize),
+					lineHeight: addUnit(this.fontSize),
 					backgroundColor: this.bgColor,
 				}
 			},
@@ -112,6 +112,8 @@
 		},
 		emits: ["loadmore"],
 		methods: {
+			addStyle,
+			addUnit,
 			loadMore() {
 				// 只有在“加载更多”的状态下才发送点击事件,内容不满一屏时无法触发底部上拉事件,所以需要点击来触发
 				if (this.status == 'loadmore') this.$emit('loadmore');

+ 8 - 5
src/uni_modules/uview-plus/components/u-modal/u-modal.vue

@@ -6,7 +6,7 @@
 		:customStyle="{
 			borderRadius: '6px', 
 			overflow: 'hidden',
-			marginTop: `-${$u.addUnit(negativeTop)}`
+			marginTop: `-${addUnit(negativeTop)}`
 		}"
 		:closeOnClickOverlay="closeOnClickOverlay"
 		:safeAreaInsetBottom="false"
@@ -16,7 +16,7 @@
 		<view
 			class="u-modal"
 			:style="{
-				width: $u.addUnit(width),
+				width: addUnit(width),
 			}"
 		>
 			<text
@@ -90,9 +90,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit } from '../../libs/function/index';
 	/**
 	 * Modal 模态框
 	 * @description 弹出模态框,常用于消息提示、消息确认、在当前页面内完成特定的交互操作。
@@ -135,6 +136,7 @@
 		},
 		emits: ["confirm", "cancel", "close"],
 		methods: {
+			addUnit,
 			// 点击确定按钮
 			confirmHandler() {
 				// 如果配置了异步关闭,将按钮值为loading状态
@@ -171,6 +173,7 @@
 		overflow: hidden;
 
 		&__title {
+			display: block;
 			font-size: 16px;
 			font-weight: bold;
 			color: $u-content-color;

+ 12 - 7
src/uni_modules/uview-plus/components/u-navbar/u-navbar.vue

@@ -4,7 +4,7 @@
 			class="u-navbar__placeholder"
 			v-if="fixed && placeholder"
 			:style="{
-				height: $u.addUnit($u.getPx(height) + $u.sys().statusBarHeight,'px'),
+				height: addUnit(getPx(height) + sys().statusBarHeight,'px'),
 			}"
 		></view>
 		<view :class="[fixed && 'u-navbar--fixed']">
@@ -16,7 +16,7 @@
 				class="u-navbar__content"
 				:class="[border && 'u-border-bottom']"
 				:style="{
-					height: $u.addUnit(height),
+					height: addUnit(height),
 					backgroundColor: bgColor,
 				}"
 			>
@@ -46,8 +46,8 @@
 					<text
 						class="u-line-1 u-navbar__content__title"
 						:style="[{
-							width: $u.addUnit(titleWidth),
-						}, $u.addStyle(titleStyle)]"
+							width: addUnit(titleWidth),
+						}, addStyle(titleStyle)]"
 					>{{ title }}</text>
 				</slot>
 				<view
@@ -73,9 +73,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, getPx, sys } from '../../libs/function/index';
 	/**
 	 * Navbar 自定义导航栏
 	 * @description 此组件一般用于在特殊情况下,需要自定义导航栏的时候用到,一般建议使用uni-app带的导航栏。
@@ -109,6 +110,10 @@
 		},
 		emits: ["leftClick", "rightClick"],
 		methods: {
+			addStyle,
+			addUnit,
+			sys,
+			getPx,
 			// 点击左侧区域
 			leftClick() {
 				// 如果配置了autoBack,自动返回上一页

+ 6 - 6
src/uni_modules/uview-plus/components/u-no-network/u-no-network.vue

@@ -43,10 +43,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { toast } from '../../libs/function/index';
 	/**
 	 * noNetwork 无网络提示
 	 * @description 该组件无需任何配置,引入即可,内部自动处理所有功能和事件。
@@ -94,10 +94,10 @@
 						this.networkType = res.networkType
 						this.emitEvent(this.networkType)
 						if (res.networkType == 'none') {
-							uni.$u.toast('无网络连接')
+							toast('无网络连接')
 							this.isConnected = false
 						} else {
-							uni.$u.toast('网络已连接')
+							toast('网络已连接')
 							this.isConnected = true
 						}
 					}

+ 6 - 5
src/uni_modules/uview-plus/components/u-notice-bar/u-notice-bar.vue

@@ -4,7 +4,7 @@
 		v-if="show"
 		:style="[{
 			backgroundColor: bgColor
-		}, $u.addStyle(customStyle)]"
+		}, addStyle(customStyle)]"
 	>
 		<template v-if="direction === 'column' || (direction === 'row' && step)">
 			<u-column-notice
@@ -39,10 +39,10 @@
 	</view>
 </template>
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle } from '../../libs/function/index';
 	/**
 	 * noticeBar 滚动通知
 	 * @description 该组件用于滚动通告场景,有多种模式可供选择
@@ -76,6 +76,7 @@
 		},
 		emits: ["click", "close"],
 		methods: {
+			addStyle,
 			// 点击通告栏
 			click(index) {
 				this.$emit('click', index)

+ 19 - 15
src/uni_modules/uview-plus/components/u-notify/u-notify.vue

@@ -7,7 +7,7 @@
 		<view
 			class="u-notify"
 			:class="[`u-notify--${tmpConfig.type}`]"
-			:style="[backgroundColor, $u.addStyle(customStyle)]"
+			:style="[backgroundColor, addStyle(customStyle)]"
 		>
 			<u-status-bar v-if="tmpConfig.safeAreaInsetTop"></u-status-bar>
 			<view class="u-notify__warpper">
@@ -23,7 +23,7 @@
 				<text
 					class="u-notify__warpper__text"
 					:style="{
-						fontSize: $u.addUnit(tmpConfig.fontSize),
+						fontSize: addUnit(tmpConfig.fontSize),
 						color: tmpConfig.color
 					}"
 				>{{ tmpConfig.message }}</text>
@@ -33,9 +33,11 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import defProps from '../../libs/config/props.js';
+	import { addUnit, addStyle, deepMerge } from '../../libs/function/index';
 	/**
 	 * notify 顶部提示
 	 * @description 该组件一般用于页面顶部向下滑出一个提示,尔后自动收起的场景
@@ -63,21 +65,21 @@
 				timer: null,
 				config: {
 					// 到顶部的距离
-					top: uni.$u.props.notify.top,
+					top: defProps.notify.top,
 					// type主题,primary,success,warning,error
-					type: uni.$u.props.notify.type,
+					type: defProps.notify.type,
 					// 字体颜色
-					color: uni.$u.props.notify.color,
+					color: defProps.notify.color,
 					// 背景颜色
-					bgColor: uni.$u.props.notify.bgColor,
+					bgColor: defProps.notify.bgColor,
 					// 展示的文字内容
-					message: uni.$u.props.notify.message,
+					message: defProps.notify.message,
 					// 展示时长,为0时不消失,单位ms
-					duration: uni.$u.props.notify.duration,
+					duration: defProps.notify.duration,
 					// 字体大小
-					fontSize: uni.$u.props.notify.fontSize,
+					fontSize: defProps.notify.fontSize,
 					// 是否留出顶部安全距离(状态栏高度)
-					safeAreaInsetTop: uni.$u.props.notify.safeAreaInsetTop
+					safeAreaInsetTop: defProps.notify.safeAreaInsetTop
 				},
 				// 合并后的配置,避免多次调用组件后,可能会复用之前使用的配置参数
 				tmpConfig: {}
@@ -94,7 +96,7 @@
 					// #endif
 				}
 				const style = {
-					top: uni.$u.addUnit(this.tmpConfig.top === 0 ? top : this.tmpConfig.top),
+					top: addUnit(this.tmpConfig.top === 0 ? top : this.tmpConfig.top),
 					// 因为组件底层为u-transition组件,必须将其设置为fixed定位
 					// 让其出现在导航栏底部
 					position: 'fixed',
@@ -135,9 +137,11 @@
 			})
 		},
 		methods: {
+			addStyle,
+			addUnit,
 			show(options) {
 				// 不将结果合并到this.config变量,避免多次调用u-toast,前后的配置造成混乱
-				this.tmpConfig = uni.$u.deepMerge(this.config, options)
+				this.tmpConfig = deepMerge(this.config, options)
 				// 任何定时器初始化之前,都要执行清除操作,否则可能会造成混乱
 				this.clearTimer()
 				this.open = true

+ 8 - 7
src/uni_modules/uview-plus/components/u-number-box/u-number-box.vue

@@ -91,9 +91,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { getPx, addUnit } from '../../libs/function/index';
 	/**
 	 * numberBox 步进器
 	 * @description 该组件一般用于商城购物选择物品数量的场景。
@@ -165,14 +166,14 @@
 		computed: {
 			getCursorSpacing() {
 				// 判断传入的单位,如果为px单位,需要转成px
-				return uni.$u.getPx(this.cursorSpacing)
+				return getPx(this.cursorSpacing)
 			},
 			// 按钮的样式
 			buttonStyle() {
 				return (type) => {
 					const style = {
 						backgroundColor: this.bgColor,
-						height: uni.$u.addUnit(this.buttonSize),
+						height: addUnit(this.buttonSize),
 						color: this.color
 					}
 					if (this.isDisabled(type)) {
@@ -187,8 +188,8 @@
 				const style = {
 					color: this.color,
 					backgroundColor: this.bgColor,
-					height: uni.$u.addUnit(this.buttonSize),
-					width: uni.$u.addUnit(this.inputWidth)
+					height: addUnit(this.buttonSize),
+					width: addUnit(this.inputWidth)
 				}
 				return style
 			},

+ 7 - 7
src/uni_modules/uview-plus/components/u-number-keyboard/u-number-keyboard.vue

@@ -39,10 +39,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { randomArray } from '../../libs/function/index';
 	/**
 	 * keyboard 键盘组件
 	 * @description
@@ -72,19 +72,19 @@
 					if (!this.random) {
 						return [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
 					} else {
-						return uni.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
+						return randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
 					}
 				} else if (!this.dotDisabled && this.mode == 'number') {
 					if (!this.random) {
 						return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0];
 					} else {
-						return uni.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0]);
+						return randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0]);
 					}
 				} else if (this.mode == 'card') {
 					if (!this.random) {
 						return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0];
 					} else {
-						return uni.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0]);
+						return randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0]);
 					}
 				}
 			},

+ 5 - 5
src/uni_modules/uview-plus/components/u-overlay/u-overlay.vue

@@ -11,10 +11,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, deepMerge } from '../../libs/function/index';
 	/**
 	 * overlay 遮罩
 	 * @description 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
@@ -41,7 +41,7 @@
 					bottom: 0,
 					'background-color': `rgba(0, 0, 0, ${this.opacity})`
 				}
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		},
 		emits: ["click"],

+ 6 - 5
src/uni_modules/uview-plus/components/u-parse/u-parse.vue

@@ -127,11 +127,12 @@ export default {
 		}
 	},
 	// #ifdef VUE2
-		beforeDestroy() {
-		// #endif
-		// #ifdef VUE3
-		beforeUnmount() {
-		// #endif
+	// beforeDestroy()
+	// #endif
+	// #ifdef VUE3
+	beforeUnmount()
+	// #endif
+	{
 		this._hook('onDetached')
 	},
 	methods: {

+ 3 - 3
src/uni_modules/uview-plus/components/u-picker-column/u-picker-column.vue

@@ -7,9 +7,9 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	/**
 	 * PickerColumn 
 	 * @description 

+ 22 - 18
src/uni_modules/uview-plus/components/u-picker/u-picker.vue

@@ -17,11 +17,11 @@
 			></u-toolbar>
 			<picker-view
 				class="u-picker__view"
-				:indicatorStyle="`height: ${$u.addUnit(itemHeight)}`"
+				:indicatorStyle="`height: ${addUnit(itemHeight)}`"
 				:value="innerIndex"
-				:immediateChange="true"
+				:immediateChange="immediateChange"
 				:style="{
-					height: `${$u.addUnit(visibleItemCount * itemHeight)}`
+					height: `${addUnit(visibleItemCount * itemHeight)}`
 				}"
 				@change="changeHandler"
 			>
@@ -31,13 +31,13 @@
 					class="u-picker__view__column"
 				>
 					<view
-						v-if="$u.test.array(item)"
+						v-if="testArray(item)"
 						class="u-picker__view__column__item u-line-1"
 						v-for="(item1, index1) in item"
 						:key="index1"
 						:style="{
-							height: $u.addUnit(itemHeight),
-							lineHeight: $u.addUnit(itemHeight),
+							height: addUnit(itemHeight),
+							lineHeight: addUnit(itemHeight),
 							fontWeight: index1 === innerIndex[index] ? 'bold' : 'normal',
 							display: 'block'
 						}"
@@ -72,15 +72,17 @@
  * @property {String}			keyName				选项对象中,需要展示的属性键名(默认 'text' )
  * @property {Boolean}			closeOnClickOverlay	是否允许点击遮罩关闭选择器(默认 false )
  * @property {Array}			defaultIndex		各列的默认索引
- * @property {Boolean}			immediateChange		是否在手指松开时立即触发change事件(默认 false )
+ * @property {Boolean}			immediateChange		是否在手指松开时立即触发change事件(默认 true )
  * @event {Function} close		关闭选择器时触发
  * @event {Function} cancel		点击取消按钮触发
  * @event {Function} change		当选择值变化时触发
  * @event {Function} confirm	点击确定按钮,返回当前选择的值
  */
-import props from './props.js';
-import mpMixin from '../../libs/mixin/mpMixin.js';
-import mixin from '../../libs/mixin/mixin.js';
+import props from './props';
+import mpMixin from '../../libs/mixin/mpMixin';
+import mixin from '../../libs/mixin/mixin';
+import { addUnit, deepClone, sleep } from '../../libs/function/index';
+import test from '../../libs/function/test';
 export default {
 	name: 'u-picker',
 	mixins: [mpMixin, mixin, props],
@@ -115,9 +117,11 @@ export default {
 	},
 	emits: ['close', 'cancel', 'confirm', 'change'],
 	methods: {
+		addUnit,
+		testArray: test.array,
 		// 获取item需要显示的文字,判别为对象还是文本
 		getItemText(item) {
-			if (uni.$u.test.object(item)) {
+			if (test.object(item)) {
 				return item[this.keyName]
 			} else {
 				return item
@@ -168,7 +172,7 @@ export default {
 			this.$emit('change', {
 				// #ifndef MP-WEIXIN || MP-LARK
 				// 微信小程序不能传递this,会因为循环引用而报错
-				picker: this,
+				// picker: this,
 				// #endif
 				value: this.innerColumns.map((item, index) => item[value[index]]),
 				index,
@@ -180,7 +184,7 @@ export default {
 		},
 		// 设置index索引,此方法可被外部调用设置
 		setIndexs(index, setLastIndex) {
-			this.innerIndex = uni.$u.deepClone(index)
+			this.innerIndex = deepClone(index)
 			if (setLastIndex) {
 				this.setLastIndex(index)
 			}
@@ -189,7 +193,7 @@ export default {
 		setLastIndex(index) {
 			// 当能进入此方法,意味着当前设置的各列默认索引,即为“上一次”的选中值,需要记录,是因为changeHandler中
 			// 需要拿前后的变化值进行对比,得出当前发生改变的是哪一列
-			this.lastIndex = uni.$u.deepClone(index)
+			this.lastIndex = deepClone(index)
 		},
 		// 设置对应列选项的所有值
 		setColumnValues(columnIndex, values) {
@@ -198,7 +202,7 @@ export default {
             // 替换完成之后将修改列之后的已选值置空
 			this.setLastIndex(this.innerIndex.slice(0, columnIndex))
 			// 拷贝一份原有的innerIndex做临时变量,将大于当前变化列的所有的列的默认索引设置为0
-			let tmpIndex = uni.$u.deepClone(this.innerIndex)
+			let tmpIndex = deepClone(this.innerIndex)
 			for (let i = 0; i < this.innerColumns.length; i++) {
 				if (i > this.columnIndex) {
 					tmpIndex[i] = 0
@@ -212,14 +216,14 @@ export default {
 			// 进行同步阻塞,因为外部得到change事件之后,可能需要执行setColumnValues更新列的值
 			// 索引如果在外部change的回调中调用getColumnValues的话,可能无法得到变更后的列值,这里进行一定延时,保证值的准确性
 			(async () => {
-				await uni.$u.sleep()
+				await sleep()
 			})()
 			return this.innerColumns[columnIndex]
 		},
 		// 设置整体各列的columns的值
 		setColumns(columns) {
 			// console.log(columns)
-			this.innerColumns = uni.$u.deepClone(columns)
+			this.innerColumns = deepClone(columns)
 			// 如果在设置各列数据时,没有被设置默认的各列索引defaultIndex,那么用0去填充它,数组长度为列的数量
 			if (this.innerIndex.length === 0) {
 				this.innerIndex = new Array(columns.length).fill(0)
@@ -234,7 +238,7 @@ export default {
 			// 进行同步阻塞,因为外部得到change事件之后,可能需要执行setColumnValues更新列的值
 			// 索引如果在外部change的回调中调用getValues的话,可能无法得到变更后的列值,这里进行一定延时,保证值的准确性
 			(async () => {
-				await uni.$u.sleep()
+				await sleep()
 			})()
 			return this.innerColumns.map((item, index) => item[this.innerIndex[index]])
 		}

+ 14 - 13
src/uni_modules/uview-plus/components/u-popup/u-popup.vue

@@ -4,6 +4,7 @@
 			:show="show"
 			@click="overlayClick"
 			v-if="overlay"
+			:zIndex="zIndex"
 			:duration="overlayDuration"
 			:customStyle="overlayStyle"
 			:opacity="overlayOpacity"
@@ -45,10 +46,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, deepMerge, sleep, sys } from '../../libs/function/index';
 	/**
 	 * popup 弹窗
 	 * @description 弹出层容器,用于展示弹窗、信息提示等内容,支持上、下、左、右和中部弹出。组件只提供容器,内部内容由用户自定义
@@ -100,27 +101,27 @@
 				}
 				style[this.mode] = 0
 				if (this.mode === 'left') {
-					return uni.$u.deepMerge(style, {
+					return deepMerge(style, {
 						bottom: 0,
 						top: 0,
 					})
 				} else if (this.mode === 'right') {
-					return uni.$u.deepMerge(style, {
+					return deepMerge(style, {
 						bottom: 0,
 						top: 0,
 					})
 				} else if (this.mode === 'top') {
-					return uni.$u.deepMerge(style, {
+					return deepMerge(style, {
 						left: 0,
 						right: 0
 					})
 				} else if (this.mode === 'bottom') {
-					return uni.$u.deepMerge(style, {
+					return deepMerge(style, {
 						left: 0,
 						right: 0,
 					})
 				} else if (this.mode === 'center') {
-					return uni.$u.deepMerge(style, {
+					return deepMerge(style, {
 						alignItems: 'center',
 						'justify-content': 'center',
 						top: 0,
@@ -136,7 +137,7 @@
 				// 不使用css方案,是因为nvue不支持css的iPhoneX安全区查询属性
 				const {
 					safeAreaInsets
-				} = uni.$u.sys()
+				} = sys()
 				if (this.mode !== 'center') {
 					style.flex = 1
 				}
@@ -145,7 +146,7 @@
 					style.backgroundColor = this.bgColor
 				}
 				if(this.round) {
-					const value = uni.$u.addUnit(this.round)
+					const value = addUnit(this.round)
 					if(this.mode === 'top') {
 						style.borderBottomLeftRadius = value
 						style.borderBottomRightRadius = value
@@ -156,7 +157,7 @@
 						style.borderRadius = value
 					} 
 				}
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			},
 			position() {
 				if (this.mode === 'center') {
@@ -213,7 +214,7 @@
 					// 判断如果在需要重新初始化的组件数组中名中,并且存在init方法的话,则执行
 					if (names.includes(child.$options.name) && typeof child?.init === 'function') {
 						// 需要进行一定的延时,因为初始化页面需要时间
-						uni.$u.sleep(50).then(() => {
+						sleep(50).then(() => {
 							child.init()
 						})
 					}

+ 1 - 1
src/uni_modules/uview-plus/components/u-qrcode/u-qrcode.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="u-qrcode">
-		<canvas class="u-qrcode__canvas" :canvas-id="cid" :style="{ width: size + unit, height: size + unit }" />
+		<canvas class="u-qrcode__canvas" :id="cid" :canvas-id="cid" :style="{ width: size + unit, height: size + unit }" />
 		<image v-show="show" :src="result" :style="{ width: size + unit, height: size + unit }" />
 	</view>
 </template>

+ 3 - 3
src/uni_modules/uview-plus/components/u-radio-group/u-radio-group.vue

@@ -8,9 +8,9 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 
 	/**
 	 * radioRroup 单选框父组件

+ 12 - 12
src/uni_modules/uview-plus/components/u-radio/u-radio.vue

@@ -33,9 +33,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, os, deepMerge, formValidate, error } from '../../libs/function/index';
 	/**
 	 * radio 单选框
 	 * @description 单选框用于有一个选择,用户只能选择其中一个的场景。搭配u-radio-group使用
@@ -59,7 +60,6 @@
 	 */
 	export default {
 		name: "u-radio",
-		
 		mixins: [mpMixin, mixin,props],
 		data() {
 			return {
@@ -121,7 +121,7 @@
 			},
 			// label大小
 			elLabelSize() {
-				return uni.$u.addUnit(this.labelSize ? this.labelSize : (this.parentData.labelSize ? this.parentData.labelSize :
+				return addUnit(this.labelSize ? this.labelSize : (this.parentData.labelSize ? this.parentData.labelSize :
 					'15'))
 			},
 			elIconColor() {
@@ -156,8 +156,8 @@
 				const style = {}
 				style.backgroundColor = this.checked && !this.elDisabled ? this.elActiveColor : '#ffffff'
 				style.borderColor = this.checked && !this.elDisabled ? this.elActiveColor : this.elInactiveColor
-				style.width = uni.$u.addUnit(this.elSize)
-				style.height = uni.$u.addUnit(this.elSize)
+				style.width = addUnit(this.elSize)
+				style.height = addUnit(this.elSize)
 				// 如果是图标在右边的话,移除它的右边距
 				if (this.parentData.iconPlacement === 'right') {
 					style.marginRight = 0
@@ -167,14 +167,14 @@
 			radioStyle() {
 				const style = {}
 				if(this.parentData.borderBottom && this.parentData.placement === 'row') {
-					uni.$u.error('检测到您将borderBottom设置为true,需要同时将u-radio-group的placement设置为column才有效')
+					error('检测到您将borderBottom设置为true,需要同时将u-radio-group的placement设置为column才有效')
 				}
 				// 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔
 				if(this.parentData.borderBottom && this.parentData.placement === 'column') {
 					// ios像素密度高,需要多一点的距离
-					style.paddingBottom = uni.$u.os() === 'ios' ? '12px' : '8px'
+					style.paddingBottom = os() === 'ios' ? '12px' : '8px'
 				}
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		},
 		mounted() {
@@ -186,7 +186,7 @@
 				// 支付宝小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环引用
 				this.updateParentData()
 				if (!this.parent) {
-					uni.$u.error('u-radio必须搭配u-radio-group组件使用')
+					error('u-radio必须搭配u-radio-group组件使用')
 				}
 				// 设置初始化时,是否默认选中的状态
 				// #ifdef VUE3
@@ -225,7 +225,7 @@
 					this.$emit('change', this.name)
 					// 尝试调用u-form的验证方法,进行一定延迟,否则微信小程序更新可能会不及时
 					this.$nextTick(() => {
-						uni.$u.formValidate(this, 'change')
+						formValidate(this, 'change')
 					})
 				}
 			},

+ 16 - 14
src/uni_modules/uview-plus/components/u-rate/u-rate.vue

@@ -3,7 +3,7 @@
         class="u-rate"
         :id="elId"
         ref="u-rate"
-        :style="[$u.addStyle(customStyle)]"
+        :style="[addStyle(customStyle)]"
     >
         <view
             class="u-rate__content"
@@ -35,7 +35,7 @@
                                 : inactiveColor
                         "
                         :custom-style="{
-                            padding: `0 ${$u.addUnit(gutter / 2)}`,
+                            padding: `0 ${addUnit(gutter / 2)}`,
                         }"
                         :size="size"
                     ></u-icon>
@@ -45,7 +45,7 @@
                     @tap.stop="clickHandler($event, index + 1)"
                     class="u-rate__content__item__icon-wrap u-rate__content__item__icon-wrap--half"
                     :style="[{
-                        width: $u.addUnit(rateWidth / 2),
+                        width: addUnit(rateWidth / 2),
                     }]"
                     ref="u-rate__content__item__icon-wrap"
                 >
@@ -63,7 +63,7 @@
                                 : inactiveColor
                         "
                         :custom-style="{
-                            padding: `0 ${$u.addUnit(gutter / 2)}`
+                            padding: `0 ${addUnit(gutter / 2)}`
                         }"
                         :size="size"
                     ></u-icon>
@@ -74,10 +74,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, guid, sleep, range, os } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	const dom = weex.requireModule("dom");
 	// #endif
@@ -108,8 +108,8 @@
 		data() {
 			return {
 				// 生成一个唯一id,否则一个页面多个评分组件,会造成冲突
-				elId: uni.$u.guid(),
-				elClass: uni.$u.guid(),
+				elId: guid(),
+				elClass: guid(),
 				rateBoxLeft: 0, // 评分盒子左边到屏幕左边的距离,用于滑动选择时计算距离
 				// #ifdef VUE3
 				activeIndex: this.modelValue,
@@ -139,15 +139,17 @@
 		emits: ['update:modelValue', 'change'],
     	// #endif
 		methods: {
+			addStyle,
+			addUnit,
 			init() {
-				uni.$u.sleep().then(() => {
+				sleep().then(() => {
 					this.getRateItemRect();
 					this.getRateIconWrapRect();
 				})
 			},
 			// 获取评分组件盒子的布局信息
 			async getRateItemRect() {
-				await uni.$u.sleep();
+				await sleep();
 				// uView封装的获取节点的方法,详见文档
 				// #ifndef APP-NVUE
 				this.$uGetRect("#" + this.elId).then((res) => {
@@ -200,7 +202,7 @@
 			// 通过点击,直接选中
 			clickHandler(e, index) {
 				// ios上,moving状态取消事件触发
-				if (uni.$u.os() === "ios" && this.moving) {
+				if (os() === "ios" && this.moving) {
 					return;
 				}
 				this.preventEvent(e);
@@ -235,7 +237,7 @@
 				// 判断当前操作的点的x坐标值,是否在允许的边界范围内
 				const allRateWidth = this.rateWidth * this.count + this.rateBoxLeft;
 				// 如果小于第一个图标的左边界,设置为最小值,如果大于所有图标的宽度,则设置为最大值
-				x = uni.$u.range(this.rateBoxLeft, allRateWidth, x) - this.rateBoxLeft
+				x = range(this.rateBoxLeft, allRateWidth, x) - this.rateBoxLeft
 				// 滑动点相对于评分盒子左边的距离
 				const distance = x;
 				// 滑动的距离,相当于多少颗星星

+ 9 - 7
src/uni_modules/uview-plus/components/u-read-more/u-read-more.vue

@@ -3,7 +3,7 @@
 		<view
 		    class="u-read-more__content"
 		    :style="{
-				height: isLongContent && status === 'close' ? $u.addUnit(showHeight) : $u.addUnit(contentHeight),
+				height: isLongContent && status === 'close' ? addUnit(showHeight) : addUnit(contentHeight),
 				textIndent: textIndent
 			}"
 		>
@@ -49,9 +49,10 @@
 	// #ifdef APP-NVUE
 	const dom = uni.requireNativePlugin('dom')
 	// #endif
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, guid, getPx, sleep } from '../../libs/function/index';
 	/**
 	 * readMore 阅读更多
 	 * @description 该组件一般用于内容较长,预先收起一部分,点击展开全部内容的场景。
@@ -76,7 +77,7 @@
 			return {
 				isLongContent: false, // 是否需要隐藏一部分内容
 				status: 'close', // 当前隐藏与显示的状态,close-收起状态,open-展开状态
-				elId: uni.$u.guid(), // 生成唯一class
+				elId: guid(), // 生成唯一class
 				contentHeight: 100, // 内容高度
 			}
 		},
@@ -92,11 +93,12 @@
 		},
 		emits: ["open", "close"],
 		methods: {
+			addUnit,
 			async init() {
 				this.getContentHeight().then(height => {
 					this.contentHeight = height
 					// 判断高度,如果真实内容高度大于占位高度,则显示收起与展开的控制按钮
-					if (height > uni.$u.getPx(this.showHeight)) {
+					if (height > getPx(this.showHeight)) {
 						this.isLongContent = true
 						this.status = 'close'
 					} else {
@@ -109,7 +111,7 @@
 			// 获取内容的高度
 			async getContentHeight() {
 				// 延时一定时间再获取节点
-				await uni.$u.sleep(30)
+				await sleep(30)
 				return new Promise(resolve => {
 					// #ifndef APP-NVUE
 					this.$uGetRect('.' + this.elId).then(res => {

+ 15 - 12
src/uni_modules/uview-plus/components/u-row-notice/u-row-notice.vue

@@ -52,9 +52,11 @@
 	</view>
 </template>
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, error, sleep, getPx } from '../../libs/function/index';
+	import test from '../../libs/function/test';
 	// #ifdef APP-NVUE
 	const animation = uni.requireNativePlugin('animation')
 	const dom = uni.requireNativePlugin('dom')
@@ -99,8 +101,8 @@
 					this.vue()
 					// #endif
 					
-					if(!uni.$u.test.string(newValue)) {
-						uni.$u.error('noticebar组件direction为row时,要求text参数为字符串形式')
+					if(!test.string(newValue)) {
+						error('noticebar组件direction为row时,要求text参数为字符串形式')
 					}
 				}
 			},
@@ -125,8 +127,9 @@
 			// 文字内容的样式
 			textStyle() {
 				let style = {}
+				style.whiteSpace = 'nowrap !important'
 				style.color = this.color
-				style.fontSize = uni.$u.addUnit(this.fontSize)
+				style.fontSize = addUnit(this.fontSize)
 				return style
 			},
 			animationStyle() {
@@ -177,8 +180,8 @@
 				this.vue()
 				// #endif
 				
-				if(!uni.$u.test.string(this.text)) {
-					uni.$u.error('noticebar组件direction为row时,要求text参数为字符串形式')
+				if(!test.string(this.text)) {
+					error('noticebar组件direction为row时,要求text参数为字符串形式')
 				}
 			},
 			// vue版处理
@@ -187,13 +190,13 @@
 				let boxWidth = 0,
 					textWidth = 0
 				// 进行一定的延时
-				await uni.$u.sleep()
+				await sleep()
 				// 查询盒子和文字的宽度
 				textWidth = (await this.$uGetRect('.u-notice__content__text')).width
 				boxWidth = (await this.$uGetRect('.u-notice__content')).width
 				// 根据t=s/v(时间=路程/速度),这里为何不需要加上#u-notice-box的宽度,因为中设置了.u-notice-content样式中设置了padding-left: 100%
 				// 恰巧计算出来的结果中已经包含了#u-notice-box的宽度
-				this.animationDuration = `${textWidth / uni.$u.getPx(this.speed)}s`
+				this.animationDuration = `${textWidth / getPx(this.speed)}s`
 				// 这里必须这样开始动画,否则在APP上动画速度不会改变
 				this.animationPlayState = 'paused'
 				setTimeout(() => {
@@ -208,7 +211,7 @@
 				let boxWidth = 0,
 					textWidth = 0
 				// 进行一定的延时
-				await uni.$u.sleep()
+				await sleep()
 				// 查询盒子和文字的宽度
 				textWidth = (await this.getNvueRect('u-notice__content__text')).width
 				boxWidth = (await this.getNvueRect('u-notice__content')).width
@@ -231,7 +234,7 @@
 						transform: `translateX(-${textWidth}px)`
 					},
 					// 滚动时间的计算为,时间 = 路程(boxWidth + textWidth) / 速度,最后转为毫秒
-					duration: (boxWidth + textWidth) / uni.$u.getPx(this.speed) * 1000,
+					duration: (boxWidth + textWidth) / getPx(this.speed) * 1000,
 					delay: 10
 				}, () => {
 					animation.transition(this.$refs['u-notice__content__text'], {

+ 8 - 7
src/uni_modules/uview-plus/components/u-row/u-row.vue

@@ -13,9 +13,10 @@
 	// #ifdef APP-NVUE
 	const dom = uni.requireNativePlugin('dom')
 	// #endif
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, deepMerge, sleep } from '../../libs/function/index';
 	/**
 	 * Row 栅格系统中的行
 	 * @description 通过基础的 12 分栏,迅速简便地创建布局 
@@ -54,10 +55,10 @@
 				}
 				// 通过给u-row左右两边的负外边距,消除u-col在有gutter时,第一个和最后一个元素的左内边距和右内边距造成的影响
 				if(this.gutter) {
-					style.marginLeft = uni.$u.addUnit(-Number(this.gutter)/2)
-					style.marginRight = uni.$u.addUnit(-Number(this.gutter)/2)
+					style.marginLeft = addUnit(-Number(this.gutter)/2)
+					style.marginRight = addUnit(-Number(this.gutter)/2)
 				}
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		},
 		emits: ["click"],
@@ -67,7 +68,7 @@
 			},
 			async getComponentWidth() {
 				// 延时一定时间,以确保节点渲染完成
-				await uni.$u.sleep()
+				await sleep()
 				return new Promise(resolve => {
 					// uView封装的获取节点的方法,详见文档
 					// #ifndef APP-NVUE

+ 5 - 4
src/uni_modules/uview-plus/components/u-safe-bottom/u-safe-bottom.vue

@@ -9,8 +9,9 @@
 
 <script>
 	import props from "./props.js";
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, deepMerge, addUnit, sys } from '../../libs/function/index';
 	/**
 	 * SafeBottom 底部安全区
 	 * @description 这个适配,主要是针对IPhone X等一些底部带指示条的机型,指示条的操作区域与页面底部存在重合,容易导致用户误操作,因此我们需要针对这些机型进行底部安全区适配。
@@ -35,9 +36,9 @@
 				const style = {};
 				// #ifdef APP-NVUE || MP-TOUTIAO
 				// nvue下,高度使用js计算填充
-				style.height = uni.$u.addUnit(uni.$u.sys().safeAreaInsets.bottom, 'px');
+				style.height = addUnit(sys().safeAreaInsets.bottom, 'px');
 				// #endif
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
+				return deepMerge(style, addStyle(this.customStyle));
 			},
 		},
 		mounted() {

+ 6 - 3
src/uni_modules/uview-plus/components/u-scroll-list/nvue.js

@@ -1,18 +1,21 @@
 // 引入bindingx,此库类似于微信小程序wxs,目的是让js运行在视图层,减少视图层和逻辑层的通信折损
 const BindingX = uni.requireNativePlugin('bindingx')
-
+import { os } from '../../libs/function/index';
 export default {
     methods: {
         // 此处不写注释,请自行体会
         nvueScrollHandler(e) {
             const anchor = this.$refs['u-scroll-list__scroll-view'].ref
-            const element = this.$refs['u-scroll-list__indicator__line__bar'].ref
+            const element = {}
+            if (this.$refs['u-scroll-list__indicator__line__bar']) {
+                element = this.$refs['u-scroll-list__indicator__line__bar'].ref
+            }
             const scrollLeft = e.contentOffset.x
             const contentSize = e.contentSize.width
             const { scrollWidth } = this
             const barAllMoveWidth = this.indicatorWidth - this.indicatorBarWidth
             // 在安卓和iOS上,需要除的倍数不一样,iOS需要除以2
-            const actionNum = uni.$u.os() === 'ios' ? 2 : 1
+            const actionNum = os() === 'ios' ? 2 : 1
             const expression = `(x / ${actionNum}) / ${contentSize - scrollWidth} * ${barAllMoveWidth}`
             BindingX.bind({
                 anchor,

+ 13 - 10
src/uni_modules/uview-plus/components/u-scroll-list/u-scroll-list.vue

@@ -28,8 +28,8 @@
 			@scrolltoupper="wxs.scrolltoupper"
 			@scrolltolower="wxs.scrolltolower"
 			:data-scrollWidth="scrollWidth"
-			:data-barWidth="$u.getPx(indicatorBarWidth)"
-			:data-indicatorWidth="$u.getPx(indicatorWidth)"
+			:data-barWidth="getPx(indicatorBarWidth)"
+			:data-indicatorWidth="getPx(indicatorWidth)"
 			:show-scrollbar="false"
 			:upper-threshold="0"
 			:lower-threshold="0"
@@ -56,7 +56,7 @@
 			<view
 				class="u-scroll-list__indicator"
 				v-if="indicator"
-				:style="[$u.addStyle(indicatorStyle)]"
+				:style="[addStyle(indicatorStyle)]"
 			>
 				<view
 					class="u-scroll-list__indicator__line"
@@ -97,9 +97,10 @@
 const dom = uni.requireNativePlugin('dom')
 import nvueMixin from "./nvue.js"
 // #endif
-import props from './props.js';
-import mpMixin from '../../libs/mixin/mpMixin.js';
-import mixin from '../../libs/mixin/mixin.js';
+import props from './props';
+import mpMixin from '../../libs/mixin/mpMixin';
+import mixin from '../../libs/mixin/mixin';
+import { addStyle, addUnit, getPx, sleep } from '../../libs/function/index';
 export default {
 	name: 'u-scroll-list',
 	// #ifndef APP-NVUE
@@ -132,14 +133,14 @@ export default {
 			style.transform = `translateX(${ x }px)`
 			// #endif
 			// 设置滑块的宽度和背景色,是每个平台都需要的
-			style.width = uni.$u.addUnit(this.indicatorBarWidth)
+			style.width = addUnit(this.indicatorBarWidth)
 			style.backgroundColor = this.indicatorActiveColor
 			return style
 		},
 		lineStyle() {
 			const style = {}
 			// 指示器整体的样式,需要设置其宽度和背景色
-			style.width = uni.$u.addUnit(this.indicatorWidth)
+			style.width = addUnit(this.indicatorWidth)
 			style.backgroundColor = this.indicatorColor
 			return style
 		}
@@ -149,6 +150,8 @@ export default {
 	},
 	emits: ["left", "right"],
 	methods: {
+		addStyle,
+		getPx,
 		init() {
 			this.getComponentWidth()
 		},
@@ -165,7 +168,7 @@ export default {
 			this.scrollEvent('right')
 			// 在普通js方案中,滚动到右边时,通过设置this.scrollInfo,模拟出滚动到右边的情况
 			// 因为上方是用过computed计算的,设置后,会自动调整滑块的位置
-			this.scrollInfo.scrollLeft = uni.$u.getPx(this.indicatorWidth) - uni.$u.getPx(this.indicatorBarWidth)
+			this.scrollInfo.scrollLeft = getPx(this.indicatorWidth) - getPx(this.indicatorBarWidth)
 		},
 		// #endif
 		//
@@ -175,7 +178,7 @@ export default {
 		// 获取组件的宽度
 		async getComponentWidth() {
 			// 延时一定时间,以获取dom尺寸
-			await uni.$u.sleep(30)
+			await sleep(30)
 			// #ifndef APP-NVUE
 			this.$uGetRect('.u-scroll-list').then(size => {
 				this.scrollWidth = size.width

+ 10 - 0
src/uni_modules/uview-plus/components/u-search/props.js

@@ -118,6 +118,16 @@ export default {
         label: {
             type: [String, Number, null],
             default: () => defProps.search.label
+        },
+        // 键盘弹起时,是否自动上推页面	
+        adjustPosition: {
+            type: Boolean,
+            default: () => true
+        },
+        // 键盘收起时,是否自动失去焦点	
+        autoBlur: {
+            type: Boolean,
+            default: () => false
         }
     }
 }

+ 12 - 6
src/uni_modules/uview-plus/components/u-search/u-search.vue

@@ -4,7 +4,7 @@
 	    @tap="clickHandler"
 	    :style="[{
 			margin: margin,
-		}, $u.addStyle(customStyle)]"
+		}, addStyle(customStyle)]"
 	>
 		<view
 		    class="u-search__content"
@@ -37,6 +37,8 @@
 			    @focus="getFocus"
 			    :focus="focus"
 			    :maxlength="maxlength"
+				:adjust-position="adjustPosition"
+				:auto-blur="autoBlur"
 			    placeholder-class="u-search__content__input--placeholder"
 			    :placeholder="placeholder"
 			    :placeholder-style="`color: ${placeholderColor}`"
@@ -46,7 +48,7 @@
 					textAlign: inputAlign,
 					color: color,
 					backgroundColor: bgColor,
-					height: $u.addUnit(height)
+					height: addUnit(height)
 				}, inputStyle]"
 			/>
 			<view
@@ -72,10 +74,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
-
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle } from '../../libs/function/index';
 	/**
 	 * search 搜索框
 	 * @description 搜索组件,集成了常见搜索框所需功能,用户可以一键引入,开箱即用。
@@ -103,6 +105,8 @@
 	 * @property {String | Number}	maxlength			输入框最大能输入的长度,-1为不限制长度  (默认 '-1' )
 	 * @property {String | Number}	height				输入框高度,单位px(默认 64 )
 	 * @property {String | Number}	label				搜索框左边显示内容
+	 * @property {Boolean}	        adjustPosition	    键盘弹起时,是否自动上推页面	
+	 * @property {Boolean}	        autoBlur	        键盘收起时,是否自动失去焦点		
 	 * @property {Object}			customStyle			定义需要用到的外部样式
 	 *
 	 * @event {Function} change 输入框内容发生变化时触发
@@ -161,6 +165,8 @@
 		},
 		emits: ['clear', 'search', 'custom', 'focus', 'blur', 'click', 'clickIcon', 'update:modelValue', 'change'],
 		methods: {
+			addStyle,
+			addUnit,
 			// 目前HX2.6.9 v-model双向绑定无效,故监听input事件获取输入框内容的变化
 			inputChange(e) {
 				this.keyword = e.detail.value;

+ 20 - 17
src/uni_modules/uview-plus/components/u-skeleton/u-skeleton.vue

@@ -11,8 +11,8 @@
 			    v-if="avatar"
 			    :class="[`u-skeleton__wrapper__avatar--${avatarShape}`, animate && 'animate']"
 			    :style="{
-						height: $u.addUnit(avatarSize),
-						width: $u.addUnit(avatarSize)
+						height: addUnit(avatarSize),
+						width: addUnit(avatarSize)
 					}"
 			></view>
 			<view
@@ -25,7 +25,7 @@
 				    v-if="title"
 				    :style="{
 							width: uTitleWidth,
-							height: $u.addUnit(titleHeight),
+							height: addUnit(titleHeight),
 						}"
 				    :class="[animate && 'animate']"
 				></view>
@@ -49,9 +49,11 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, sleep, error } from '../../libs/function/index';
+	import test from '../../libs/function/test';
 	// #ifdef APP-NVUE
 	// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
 	const dom = uni.requireNativePlugin('dom')
@@ -90,26 +92,26 @@
 		computed: {
 			rowsArray() {
 				if (/%$/.test(this.rowsHeight)) {
-					uni.$u.error('rowsHeight参数不支持百分比单位')
+					error('rowsHeight参数不支持百分比单位')
 				}
 				const rows = []
 				for (let i = 0; i < this.rows; i++) {
 					let item = {},
 						// 需要预防超出数组边界的情况
-						rowWidth = uni.$u.test.array(this.rowsWidth) ? (this.rowsWidth[i] || (i === this.rows - 1 ? '70%' : '100%')) : i ===
+						rowWidth = test.array(this.rowsWidth) ? (this.rowsWidth[i] || (i === this.rows - 1 ? '70%' : '100%')) : i ===
 						this.rows - 1 ? '70%' : this.rowsWidth,
-						rowHeight = uni.$u.test.array(this.rowsHeight) ? (this.rowsHeight[i] || '18px') : this.rowsHeight
+						rowHeight = test.array(this.rowsHeight) ? (this.rowsHeight[i] || '18px') : this.rowsHeight
 					// 如果有title占位图,第一个段落占位图的外边距需要大一些,如果没有title占位图,第一个段落占位图则无需外边距
 					// 之所以需要这么做,是因为weex的无能,以提升性能为借口不支持css的一些伪类
 					item.marginTop = !this.title && i === 0 ? 0 : this.title && i === 0 ? '20px' : '12px'
 					// 如果设置的为百分比的宽度,转换为px值,因为nvue不支持百分比单位
 					if (/%$/.test(rowWidth)) {
 						// 通过parseInt提取出百分比单位中的数值部分,除以100得到百分比的小数值
-						item.width = uni.$u.addUnit(this.width * parseInt(rowWidth) / 100)
+						item.width = addUnit(this.width * parseInt(rowWidth) / 100)
 					} else {
-						item.width = uni.$u.addUnit(rowWidth)
+						item.width = addUnit(rowWidth)
 					}
-					item.height = uni.$u.addUnit(rowHeight)
+					item.height = addUnit(rowHeight)
 					rows.push(item)
 				}
 				// console.log(rows);
@@ -119,11 +121,11 @@
 				let tWidth = 0
 				if (/%$/.test(this.titleWidth)) {
 					// 通过parseInt提取出百分比单位中的数值部分,除以100得到百分比的小数值
-					tWidth = uni.$u.addUnit(this.width * parseInt(this.titleWidth) / 100)
+					tWidth = addUnit(this.width * parseInt(this.titleWidth) / 100)
 				} else {
-					tWidth = uni.$u.addUnit(this.titleWidth)
+					tWidth = addUnit(this.titleWidth)
 				}
-				return uni.$u.addUnit(tWidth)
+				return addUnit(tWidth)
 			},
 			
 		},
@@ -131,6 +133,7 @@
 			this.init()
 		},
 		methods: {
+			addUnit,
 			init() {
 				this.getComponentWidth()
 				// #ifdef APP-NVUE
@@ -140,7 +143,7 @@
 			async setNvueAnimation() {
 				// #ifdef APP-NVUE
 				// 为了让opacity:1的状态保持一定时间,这里做一个延时
-				await uni.$u.sleep(500)
+				await sleep(500)
 				const skeleton = this.$refs['u-skeleton__wrapper'];
 				skeleton && this.loading && this.animate && animation.transition(skeleton, {
 					styles: {
@@ -165,7 +168,7 @@
 			// 获取组件的宽度
 			async getComponentWidth() {
 				// 延时一定时间,以获取dom尺寸
-				await uni.$u.sleep(20)
+				await sleep(20)
 				// #ifndef APP-NVUE
 				this.$uGetRect('.u-skeleton__wrapper__content').then(size => {
 					this.width = size.width

+ 2 - 1
src/uni_modules/uview-plus/components/u-slider/mpwxs.js

@@ -1,3 +1,4 @@
+import { sleep } from '../../libs/function/index';
 export default {
     data() {
         return {
@@ -23,7 +24,7 @@ export default {
         // 获取slider尺寸
         getSliderRect() {
             // 获取滑块条的尺寸信息
-            uni.$u.sleep().then(() => {
+            sleep().then(() => {
                 this.$uGetRect('.u-slider').then((rect) => {
                     this.info.width = rect.width
                     this.info.left = rect.left

+ 2 - 2
src/uni_modules/uview-plus/components/u-slider/nvue - 副本.js

@@ -8,7 +8,7 @@ const BindingX = uni.requireNativePlugin('bindingx')
 const dom = uni.requireNativePlugin('dom')
 // nvue中用于操作元素动画的库,类似于uni.animation,只不过uni.animation不能用于nvue
 const animation = uni.requireNativePlugin('animation')
-
+import { range } from '../../libs/function/index';
 export default {
 	data() {
 		return {
@@ -141,7 +141,7 @@ export default {
 			}, (e) => {
 				if (e.state === 'end' || e.state === 'exit') {
 					// 
-					this.x = uni.$u.range(0, left + width, e.deltaX + this.x)
+					this.x = range(0, left + width, e.deltaX + this.x)
 					// 根据偏移值,得出移动的百分比,进而修改双向绑定的v-model的值
 					const value = (this.x / width) * 100
 					const percent = this.formatStep(value)

+ 2 - 2
src/uni_modules/uview-plus/components/u-slider/nvue.js

@@ -8,7 +8,7 @@ const BindingX = uni.requireNativePlugin('bindingx')
 const dom = uni.requireNativePlugin('dom')
 // nvue中用于操作元素动画的库,类似于uni.animation,只不过uni.animation不能用于nvue
 const animation = uni.requireNativePlugin('animation')
-
+import { range } from '../../libs/function/index';
 export default {
     data() {
         return {
@@ -180,7 +180,7 @@ export default {
         // 移动点占总长度的百分比,此处需要先除以step,是为了保证step大于1时,比如10,那么在滑动11,12px这样的
         // 距离时,实际上滑块是不会滑动的,到了16,17px,经过四舍五入后,就变成了20px,进行了下一个跳变
         format(value) {
-            return Math.round(uni.$u.range(this.min, this.max, value) / this.step) * this.step
+            return Math.round(range(this.min, this.max, value) / this.step) * this.step
         },
         getRange() {
             const {

+ 8 - 5
src/uni_modules/uview-plus/components/u-slider/u-slider.vue

@@ -20,15 +20,18 @@
 	</view>
 </template>
 
-<script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
	import { addStyle, getPx } from '../../libs/function/index.js';
+<script>
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, getPx } from '../../libs/function/index.js';
 	export default {
 		name: 'up-slider',
 		mixins: [mpMixin, mixin, props],
 		emits: ["changing", "change", "update:modelValue"],
-		methods: {
			addStyle,
			getPx,
+		methods: {
+			addStyle,
+			getPx,
 			// 拖动过程中触发
 			changingHandler(e) {
 				const {

+ 6 - 5
src/uni_modules/uview-plus/components/u-status-bar/u-status-bar.vue

@@ -8,9 +8,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, deepMerge, sys } from '../../libs/function/index';
 	/**
 	 * StatbusBar 状态栏占位
 	 * @description 本组件主要用于状态填充,比如在自定导航栏的时候,它会自动适配一个恰当的状态栏高度。
@@ -30,9 +31,9 @@
 			style() {
 				const style = {}
 				// 状态栏高度,由于某些安卓和微信开发工具无法识别css的顶部状态栏变量,所以使用js获取的方式
-				style.height = uni.$u.addUnit(uni.$u.sys().statusBarHeight, 'px')
+				style.height = addUnit(sys().statusBarHeight, 'px')
 				style.backgroundColor = this.bgColor
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			}
 		},
 	}

+ 14 - 12
src/uni_modules/uview-plus/components/u-steps-item/u-steps-item.vue

@@ -47,9 +47,11 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { sleep, error } from '../../libs/function/index';
+	import color from '../../libs/config/color';
 	// #ifdef APP-NVUE
 	const dom = uni.requireNativePlugin('dom')
 	// #endif
@@ -103,7 +105,7 @@
 					style.height = this.size.height + 'px'
 					// style.top = this.size.height / 2 + 'px'
 				}
-				style.backgroundColor = this.parent.children?.[this.index + 1]?.error ? uni.$u.color.error : this.index <
+				style.backgroundColor = this.parent.children?.[this.index + 1]?.error ? color.error : this.index <
 					this
 					.parentData
 					.current ? this.parentData.activeColor : this.parentData.inactiveColor
@@ -128,22 +130,22 @@
 				}
 			},
 			statusColor() {
-				let color = ''
+				let colorTmp = ''
 				switch (this.statusClass) {
 					case 'finish':
-						color = this.parentData.activeColor
+						colorTmp = this.parentData.activeColor
 						break
 					case 'error':
-						color = uni.$u.color.error
+						colorTmp = color.error
 						break
 					case 'process':
-						color = this.parentData.dot ? this.parentData.activeColor : 'transparent'
+						colorTmp = this.parentData.dot ? this.parentData.activeColor : 'transparent'
 						break
 					default:
-						color = this.parentData.inactiveColor
+						colorTmp = this.parentData.inactiveColor
 						break
 				}
-				return color
+				return colorTmp
 			},
 			contentStyle() {
 				const style = {}
@@ -160,7 +162,7 @@
 		},
 		mounted() {
 			this.parent && this.parent.updateFromChild()
-			uni.$u.sleep().then(() => {
+			sleep().then(() => {
 				this.getStepsItemRect()
 			})
 		},
@@ -169,7 +171,7 @@
 				// 初始化数据
 				this.updateParentData()
 				if (!this.parent) {
-					return uni.$u.error('u-steps-item必须要搭配u-steps组件使用')
+					return error('u-steps-item必须要搭配u-steps组件使用')
 				}
 				this.index = this.parent.children.indexOf(this)
 				this.childLength = this.parent.children.length

+ 5 - 4
src/uni_modules/uview-plus/components/u-steps/u-steps.vue

@@ -8,9 +8,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import test from '../../libs/function/test';
 	/**
 	 * Steps 步骤条
 	 * @description 该组件一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
@@ -50,7 +51,7 @@
 			updateChildData() {
 				this.children.map(child => {
 					// 先判断子组件是否存在对应的方法
-					uni.$u.test.func((child || {}).updateFromParent()) && child.updateFromParent()
+					test.func((child || {}).updateFromParent()) && child.updateFromParent()
 				})
 			},
 			// 接受子组件的通知,去修改其他子组件的数据

+ 12 - 10
src/uni_modules/uview-plus/components/u-sticky/u-sticky.vue

@@ -14,9 +14,11 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, deepMerge, getPx, guid, sys, os } from '../../libs/function/index';
+	import zIndex from '../../libs/config/zIndex';
 	/**
 	 * sticky 吸顶
 	 * @description 该组件与CSS中position: sticky属性实现的效果一致,当组件达到预设的到顶部距离时, 就会固定在指定位置,组件位置大于预设的顶部距离时,会重新按照正常的布局排列。
@@ -39,7 +41,7 @@
 			return {
 				cssSticky: false, // 是否使用css的sticky实现
 				stickyTop: 0, // 吸顶的top值,因为可能受自定义导航栏影响,最终的吸顶值非offsetTop值
-				elId: uni.$u.guid(),
+				elId: guid(),
 				left: 0, // js模式时,吸顶的内容因为处于postition: fixed模式,为了和原来保持一致的样式,需要记录并重新设置它的left,height,width属性
 				width: 'auto',
 				height: 'auto',
@@ -53,7 +55,7 @@
 					if (this.cssSticky) {
 						style.position = 'sticky'
 						style.zIndex = this.uZindex
-						style.top = uni.$u.addUnit(this.stickyTop)
+						style.top = addUnit(this.stickyTop)
 					} else {
 						style.height = this.fixed ? this.height + 'px' : 'auto'
 					}
@@ -67,7 +69,7 @@
 					// #endif
 				}
 				style.backgroundColor = this.bgColor
-				return uni.$u.deepMerge(uni.$u.addStyle(this.customStyle), style)
+				return deepMerge(addStyle(this.customStyle), style)
 			},
 			// 吸顶内容的样式
 			stickyContent() {
@@ -82,7 +84,7 @@
 				return style
 			},
 			uZindex() {
-				return this.zIndex ? this.zIndex : uni.$u.zIndex.sticky
+				return this.zIndex ? this.zIndex : zIndex.sticky
 			}
 		},
 		mounted() {
@@ -137,7 +139,7 @@
 				observer && observer.disconnect()
 			},
 			getStickyTop() {
-				this.stickyTop = uni.$u.getPx(this.offsetTop) + uni.$u.getPx(this.customNavHeight)
+				this.stickyTop = getPx(this.offsetTop) + getPx(this.customNavHeight)
 			},
 			async checkSupportCssSticky() {
 				// #ifdef H5
@@ -148,7 +150,7 @@
 				// #endif
 
 				// 如果安卓版本高于8.0,依然认为是支持css sticky的(因为安卓7在某些机型,可能不支持sticky)
-				if (uni.$u.os() === 'android' && Number(uni.$u.sys().system) > 8) {
+				if (os() === 'android' && Number(sys().system) > 8) {
 					this.cssSticky = true
 				}
 
@@ -158,7 +160,7 @@
 				// #endif
 
 				// ios上,从ios6开始,都是支持css sticky的
-				if (uni.$u.os() === 'ios') {
+				if (os() === 'ios') {
 					this.cssSticky = true
 				}
 

+ 8 - 6
src/uni_modules/uview-plus/components/u-subsection/u-subsection.vue

@@ -3,7 +3,7 @@
         class="u-subsection"
         ref="u-subsection"
         :class="[`u-subsection--${mode}`]"
-        :style="[$u.addStyle(customStyle), wrapperStyle]"
+        :style="[addStyle(customStyle), wrapperStyle]"
     >
         <view
             class="u-subsection__bar cursor-pointer"
@@ -53,8 +53,9 @@ const dom = uni.requireNativePlugin("dom");
 const animation = uni.requireNativePlugin("animation");
 // #endif
 import props from "./props.js";
-import mpMixin from '../../libs/mixin/mpMixin.js';
-import mixin from '../../libs/mixin/mixin.js';
+import mpMixin from '../../libs/mixin/mpMixin';
+import mixin from '../../libs/mixin/mixin';
+import { addStyle, addUnit, sleep } from '../../libs/function/index';
 /**
  * Subsection 分段器
  * @description 该分段器一般用于用户从几个选项中选择某一个的场景
@@ -102,7 +103,7 @@ export default {
                 // 故用animation模块进行位移
                 const ref = this.$refs?.["u-subsection__bar"]?.ref;
                 // 不存在ref的时候(理解为第一次初始化时,需要渲染dom,进行一定延时再获取ref),这里的100ms是经过测试得出的结果(某些安卓需要延时久一点),勿随意修改
-                uni.$u.sleep(ref ? 0 : 100).then(() => {
+                sleep(ref ? 0 : 100).then(() => {
                     animation.transition(this.$refs["u-subsection__bar"].ref, {
                         styles: {
                             transform: `translateX(${
@@ -162,7 +163,7 @@ export default {
                 const style = {};
                 style.fontWeight =
                     this.bold && this.innerCurrent === index ? "bold" : "normal";
-                style.fontSize = uni.$u.addUnit(this.fontSize);
+                style.fontSize = addUnit(this.fontSize);
                 // subsection模式下,激活时默认为白色的文字
                 if (this.mode === "subsection") {
                     style.color =
@@ -190,9 +191,10 @@ export default {
     },
 	emits: ["change"],
     methods: {
+        addStyle,
         init() {
             this.innerCurrent = this.current
-            uni.$u.sleep().then(() => this.getRect());
+            sleep().then(() => this.getRect());
         },
 		// 判断展示文本
 		getText(item) {

+ 3 - 3
src/uni_modules/uview-plus/components/u-swipe-action-item/nvue - backup.js

@@ -2,7 +2,7 @@
 const dom = uni.requireNativePlugin('dom')
 // nvue中用于操作元素动画的库,类似于uni.animation,只不过uni.animation不能用于nvue
 const animation = uni.requireNativePlugin('animation')
-
+import { sleep } from '../../libs/function/index';
 export default {
     data() {
         return {
@@ -41,7 +41,7 @@ export default {
             immediate: true,
             handler(n) {
                 // if(n === true) {
-                // 	uni.$u.sleep(50).then(() => {
+                // 	sleep(50).then(() => {
                 // 		this.openSwipeAction()
                 // 	})
                 // } else {
@@ -51,7 +51,7 @@ export default {
         }
     },
     mounted() {
-        uni.$u.sleep(20).then(() => {
+        sleep(20).then(() => {
             this.queryRect()
         })
     },

+ 3 - 3
src/uni_modules/uview-plus/components/u-swipe-action-item/nvue.js

@@ -2,7 +2,7 @@
 const dom = uni.requireNativePlugin('dom');
 const bindingX = uni.requireNativePlugin('bindingx');
 const animation = uni.requireNativePlugin('animation');
-
+import { getPx, getDuration } from '../../libs/function/index';
 export default {
 	data() {
 		return {
@@ -99,7 +99,7 @@ export default {
 						this.$nextTick(() => {
 							this.status = deltaX <= -this.buttonsWidth ? 'open' : 'close'
 						})
-					} else if(Math.abs(deltaX) > uni.$u.getPx(this.threshold)) {
+					} else if(Math.abs(deltaX) > getPx(this.threshold)) {
 						// 在移动大于阈值、并且小于总按钮宽度时,进行自动打开或者关闭
 						// 移动距离大于0时,意味着需要关闭状态
 						if(Math.abs(deltaX) < this.buttonsWidth) {
@@ -155,7 +155,7 @@ export default {
 				styles: {
 					transform: `translateX(${x}px)`,
 				},
-				duration: uni.$u.getDuration(this.duration, false),
+				duration: getDuration(this.duration, false),
 				timingFunction: 'ease-in-out'
 			}, () => {
 				this.moving = false

+ 8 - 5
src/uni_modules/uview-plus/components/u-swipe-action-item/u-swipe-action-item.vue

@@ -16,7 +16,7 @@
 						}, item.style]">
 						<u-icon v-if="item.icon" :name="item.icon"
 							:color="item.style && item.style.color ? item.style.color : '#ffffff'"
-							:size="item.iconSize ? $u.addUnit(item.iconSize) : item.style && item.style.fontSize ? $u.getPx(item.style.fontSize) * 1.2 : 17"
+							:size="item.iconSize ? addUnit(item.iconSize) : item.style && item.style.fontSize ? getPx(item.style.fontSize) * 1.2 : 17"
 							:customStyle="{
 								marginRight: item.text ? '2px' : 0
 							}"></u-icon>
@@ -60,9 +60,10 @@
 <!-- #endif -->
 <script>
 	import touch from '../../libs/mixin/touch.js'
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, getPx, sleep } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	import nvue from './nvue.js';
 	// #endif
@@ -138,11 +139,13 @@
 			this.init()
 		},
 		methods: {
+			addUnit,
+			getPx,
 			init() {
 				// 初始化父组件数据
 				this.updateParentData()
 				// #ifndef APP-NVUE
-				uni.$u.sleep().then(() => {
+				sleep().then(() => {
 					this.queryRect()
 				})
 				// #endif

+ 3 - 3
src/uni_modules/uview-plus/components/u-swipe-action/u-swipe-action.vue

@@ -5,9 +5,9 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
 	/**
 	 * SwipeAction 滑动单元格 
 	 * @description 该组件一般用于左滑唤出操作菜单的场景,用的最多的是左滑删除操作

+ 10 - 7
src/uni_modules/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue

@@ -5,7 +5,7 @@
 			v-if="indicatorMode === 'line'"
 			:class="[`u-swiper-indicator__wrapper--${indicatorMode}`]"
 			:style="{
-				width: $u.addUnit(lineWidth * length),
+				width: addUnit(lineWidth * length),
 				backgroundColor: indicatorInactiveColor
 			}"
 		>
@@ -25,16 +25,16 @@
 				:class="[index === current && 'u-swiper-indicator__wrapper__dot--active']"
 				:style="[dotStyle(index)]"
 			>
-
 			</view>
 		</view>
 	</view>
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit } from '../../libs/function/index';
 	/**
 	 * SwiperIndicator 轮播图指示器
 	 * @description 该组件一般用于导航轮播,广告展示等场景,可开箱即用,
@@ -58,8 +58,8 @@
 			// 指示器为线型的样式
 			lineStyle() {
 				let style = {}
-				style.width = uni.$u.addUnit(this.lineWidth)
-				style.transform = `translateX(${ uni.$u.addUnit(this.current * this.lineWidth) })`
+				style.width = addUnit(this.lineWidth)
+				style.transform = `translateX(${ addUnit(this.current * this.lineWidth) })`
 				style.backgroundColor = this.indicatorActiveColor
 				return style
 			},
@@ -72,6 +72,9 @@
 				}
 			}
 		},
+		methods: {
+			addUnit
+		}
 	}
 </script>
 

+ 35 - 24
src/uni_modules/uview-plus/components/u-swiper/u-swiper.vue

@@ -2,9 +2,9 @@
 	<view
 		class="u-swiper"
 		:style="{
-			backgroundColor: bgColor,
-			height: $u.addUnit(height),
-			borderRadius: $u.addUnit(radius)
+			backgroundColor: bgColor,
+			height: addUnit(height),
+			borderRadius: addUnit(radius)
 		}"
 	>
 		<view
@@ -13,10 +13,12 @@
 		>
 			<u-loading-icon mode="circle"></u-loading-icon>
 		</view>
-		<swiper
			v-else
+		<swiper
+			v-else
 			class="u-swiper__wrapper"
-			:style="{
				flex: '1',
-				height: $u.addUnit(height)
+			:style="{
+				flex: '1',
+				height: addUnit(height)
 			}"
 			@change="change"
 			:circular="circular"
@@ -25,8 +27,8 @@
 			:autoplay="autoplay"
 			:current="current"
 			:currentItemId="currentItemId"
-			:previousMargin="$u.addUnit(previousMargin)"
-			:nextMargin="$u.addUnit(nextMargin)"
+			:previousMargin="addUnit(previousMargin)"
+			:nextMargin="addUnit(nextMargin)"
 			:acceleration="acceleration"
 			:displayMultipleItems="displayMultipleItems"
 			:easingFunction="easingFunction"
@@ -48,8 +50,8 @@
 						:mode="imgMode"
 						@tap="clickHandler(index)"
 						:style="{
-							height: $u.addUnit(height),
-							borderRadius: $u.addUnit(radius)
+							height: addUnit(height),
+							borderRadius: addUnit(radius)
 						}"
 					></image>
 					<video
@@ -59,21 +61,21 @@
 						:enable-progress-gesture="false"
 						:src="getSource(item)"
 						:poster="getPoster(item)"
-						:title="showTitle && $u.test.object(item) && item.title ? item.title : ''"
+						:title="showTitle && testObject(item) && item.title ? item.title : ''"
 						:style="{
-							height: $u.addUnit(height)
+							height: addUnit(height)
 						}"
 						controls
 						@tap="clickHandler(index)"
 					></video>
 					<text
-						v-if="showTitle && $u.test.object(item) && item.title && $u.test.image(getSource(item))"
+						v-if="showTitle && testObject(item) && item.title && testImage(getSource(item))"
 						class="u-swiper__wrapper__item__wrapper__title u-line-1"
 					>{{ item.title }}</text>
 				</view>
 			</swiper-item>
 		</swiper>
-		<view class="u-swiper__indicator" :style="[$u.addStyle(indicatorStyle)]">
+		<view class="u-swiper__indicator" :style="[addStyle(indicatorStyle)]">
 			<slot name="indicator">
 				<u-swiper-indicator
 					v-if="!loading && indicator && !showTitle"
@@ -87,11 +89,12 @@
 		</view>
 	</view>
 </template>
-
 <script>
 	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addUnit, addStyle, error } from '../../libs/function/index';
+	import test from '../../libs/function/test';
 	/**
 	 * Swiper 轮播图
 	 * @description 该组件一般用于导航轮播,广告展示等场景,可开箱即用,
@@ -147,7 +150,7 @@
 					// 左右流出空间的写法不支持nvue和头条
 					// 只有配置了此二值,才加上对应的圆角,以及缩放
 					if (this.nextMargin && this.previousMargin) {
-						style.borderRadius = uni.$u.addUnit(this.radius)
+						style.borderRadius = addUnit(this.radius)
 						if (index !== this.currentIndex) style.transform = 'scale(0.92)'
 					}
 					// #endif
@@ -156,10 +159,14 @@
 			}
 		},
 		methods: {
+			addStyle,
+			addUnit,
+			testObject: test.object,
+			testImage: test.image,
 			getItemType(item) {
-				if (typeof item === 'string') return uni.$u.test.video(this.getSource(item)) ? 'video' : 'image'
+				if (typeof item === 'string') return test.video(this.getSource(item)) ? 'video' : 'image'
 				if (typeof item === 'object' && this.keyName) {
-				if (!item.type) return uni.$u.test.video(this.getSource(item)) ? 'video' : 'image'
+				if (!item.type) return test.video(this.getSource(item)) ? 'video' : 'image'
 				if (item.type === 'image') return 'image'
 				if (item.type === 'video') return 'video'
 				return 'image'
@@ -169,7 +176,7 @@
 			getSource(item) {
 				if (typeof item === 'string') return item
 				if (typeof item === 'object' && this.keyName) return item[this.keyName]
-				else uni.$u.error('请按格式传递列表参数')
+				else error('请按格式传递列表参数')
 				return ''
 			},
 			// 轮播切换事件
@@ -185,7 +192,7 @@
 			// 切换轮播时,暂停视频播放
 			pauseVideo(index) {
 				const lastItem = this.getSource(this.list[index])
-				if (uni.$u.test.video(lastItem)) {
+				if (test.video(lastItem)) {
 					// 当视频隐藏时,暂停播放
 					const video = uni.createVideoContext(`video-${index}`, this)
 					video.pause()
@@ -205,7 +212,10 @@
 
 <style lang="scss" scoped>
 	@import "../../libs/css/components.scss";
-	
	.u-swiper__wrapper {
		flex: 1;
	}
+	
+	.u-swiper__wrapper {
+		flex: 1;
+	}
 	.u-swiper {
 		@include flex;
 		justify-content: center;
@@ -213,7 +223,8 @@
 		position: relative;
 		overflow: hidden;
 
-		&__wrapper {
			flex: 1;
+		&__wrapper {
+			flex: 1;
 
 			&__item {
 				flex: 1;

+ 15 - 13
src/uni_modules/uview-plus/components/u-switch/u-switch.vue

@@ -2,7 +2,7 @@
 	<view
 	    class="u-switch cursor-pointer"
 	    :class="[disabled && 'u-switch--disabled']"
-	    :style="[switchStyle, $u.addStyle(customStyle)]"
+	    :style="[switchStyle, addStyle(customStyle)]"
 	    @tap="clickHandler"
 	>
 		<view
@@ -38,9 +38,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, addUnit, error } from '../../libs/function/index';
 	/**
 	 * switch 开关选择器
 	 * @description 选择开关一般用于只有两个选择,且只能选其一的场景。
@@ -69,7 +70,7 @@
 				immediate: true,
 				handler(n) {
 					if(n !== this.inactiveValue && n !== this.activeValue) {
-						uni.$u.error('v-model绑定的值必须为inactiveValue、activeValue二者之一')
+						error('v-model绑定的值必须为inactiveValue、activeValue二者之一')
 					}
 				}
 			},
@@ -79,7 +80,7 @@
 				immediate: true,
 				handler(n) {
 					if(n !== this.inactiveValue && n !== this.activeValue) {
-						uni.$u.error('v-model绑定的值必须为inactiveValue、activeValue二者之一')
+						error('v-model绑定的值必须为inactiveValue、activeValue二者之一')
 					}
 				}
 			}
@@ -102,8 +103,8 @@
 			switchStyle() {
 				let style = {}
 				// 这里需要加2,是为了腾出边框的距离,否则圆点node会和外边框紧贴在一起
-				style.width = uni.$u.addUnit(this.size * 2 + 2)
-				style.height = uni.$u.addUnit(Number(this.size) + 2)
+				style.width = addUnit(this.size * 2 + 2)
+				style.height = addUnit(Number(this.size) + 2)
 				// style.borderColor = this.value ? 'rgba(0, 0, 0, 0)' : 'rgba(0, 0, 0, 0.12)'
 				// 如果自定义了“非激活”演示,name边框颜色设置为透明(跟非激活颜色一致)
 				// 这里不能简单的设置为非激活的颜色,否则打开状态时,会有边框,所以需要透明
@@ -116,17 +117,17 @@
 			nodeStyle() {
 				let style = {}
 				// 如果自定义非激活颜色,将node圆点的尺寸减少两个像素,让其与外边框距离更大一点
-				style.width = uni.$u.addUnit(this.size - this.space)
-				style.height = uni.$u.addUnit(this.size - this.space)
-				const translateX = this.isActive ? uni.$u.addUnit(this.space) : uni.$u.addUnit(this.size);
+				style.width = addUnit(this.size - this.space)
+				style.height = addUnit(this.size - this.space)
+				const translateX = this.isActive ? addUnit(this.space) : addUnit(this.size);
 				style.transform = `translateX(-${translateX})`
 				return style
 			},
 			bgStyle() {
 				let style = {}
 				// 这里配置一个多余的元素在HTML中,是为了让switch切换时,有更良好的背景色扩充体验(见实际效果)
-				style.width = uni.$u.addUnit(Number(this.size) * 2 - this.size / 2)
-				style.height = uni.$u.addUnit(this.size)
+				style.width = addUnit(Number(this.size) * 2 - this.size / 2)
+				style.height = addUnit(this.size)
 				style.backgroundColor = this.inactiveColor
 				// 打开时,让此元素收缩,否则反之
 				style.transform = `scale(${this.isActive ? 0 : 1})`
@@ -141,6 +142,7 @@
 		emits: ['update:modelValue', 'change'],
     	// #endif
 		methods: {
+			addStyle,
 			clickHandler() {
 				if (!this.disabled && !this.loading) {
 					const oldValue = this.isActive ? this.inactiveValue : this.activeValue

+ 7 - 5
src/uni_modules/uview-plus/components/u-tabbar-item/u-tabbar-item.vue

@@ -1,7 +1,7 @@
 <template>
 	<view
 	    class="u-tabbar-item cursor-pointer"
-	    :style="[$u.addStyle(customStyle)]"
+	    :style="[addStyle(customStyle)]"
 	    @tap="clickHandler"
 	>
 		<view class="u-tabbar-item__icon">
@@ -43,9 +43,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, error } from '../../libs/function/index';
 	/**
 	 * TabbarItem 底部导航栏子组件
 	 * @description 此组件提供了自定义tabbar的能力。
@@ -82,11 +83,12 @@
 		},
 		emits: ["click", "change"],
 		methods: {
+			addStyle,
 			init() {
 				// 支付宝小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环引用
 				this.updateParentData()
 				if (!this.parent) {
-					uni.$u.error('u-tabbar-item必须搭配u-tabbar组件使用')
+					error('u-tabbar-item必须搭配u-tabbar组件使用')
 				}
 				// 本子组件在u-tabbar的children数组中的索引
 				const index = this.parent.children.indexOf(this)

+ 6 - 5
src/uni_modules/uview-plus/components/u-tabbar/u-tabbar.vue

@@ -23,9 +23,10 @@
 </template>
 
 <script>
-	import props from './props.js';
-	import mpMixin from '../../libs/mixin/mpMixin.js';
-	import mixin from '../../libs/mixin/mixin.js';
+	import props from './props';
+	import mpMixin from '../../libs/mixin/mpMixin';
+	import mixin from '../../libs/mixin/mixin';
+	import { addStyle, deepMerge, sleep } from '../../libs/function/index';
 	// #ifdef APP-NVUE
 	const dom = uni.requireNativePlugin('dom')
 	// #endif
@@ -59,7 +60,7 @@
 					zIndex: this.zIndex
 				}
 				// 合并来自父组件的customStyle样式
-				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+				return deepMerge(style, addStyle(this.customStyle))
 			},
 			// 监听多个参数的变化,通过在computed执行对应的操作
 			updateChild() {
@@ -94,7 +95,7 @@
 			async setPlaceholderHeight() {
 				if (!this.fixed || !this.placeholder) return
 				// 延时一定时间
-				await uni.$u.sleep(20)
+				await sleep(20)
 				// #ifndef APP-NVUE
 				this.$uGetRect('.u-tabbar__content').then(({height = 50}) => {
 					// 修复IOS safearea bottom 未填充高度

部分文件因文件數量過多而無法顯示