uview-plus 3.3.11 → 3.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 3.3.13(2024-08-08)
2
+ feat: input支持调用原生组件的focus和blur方法
3
+
4
+ improvement: grid-item条件编译优化
5
+
6
+ add: 新增迷你导航组件
7
+
8
+ ## 3.3.12(2024-08-06)
9
+ improvement: $u挂载时机调整便于打包分离chunk
10
+
11
+ fix: steps新增itemStyle属性名称冲突
12
+
1
13
  ## 3.3.11(2024-08-05)
2
14
  feat: 新增支持upload组件的deletable/maxCount/accept变更监听 #333
3
15
 
@@ -92,7 +92,7 @@
92
92
  @import "../../libs/css/components.scss";
93
93
  $u-grid-width:100% !default;
94
94
  .u-grid {
95
- /* #ifdef MP */
95
+ /* #ifdef APP-NVUE */
96
96
  width: $u-grid-width;
97
97
  position: relative;
98
98
  box-sizing: border-box;
@@ -105,7 +105,7 @@
105
105
  align-items: center;
106
106
  // 在uni-app中应尽量避免使用flex布局以外的方式,因为nvue/uvue等方案都支持flex布局
107
107
  // 这里使用grid布局使用为目前20240409uni-app在抖音小程序开启virtualHost时有bug,存在事件失效问题。
108
- /* #ifdef MP */
108
+ /* #ifndef APP-NVUE */
109
109
  display: grid;
110
110
  grid-template-columns: repeat(v-bind(col), 1fr);
111
111
  /* #endif */
@@ -52,9 +52,6 @@
52
52
  // #ifdef APP-NVUE
53
53
  width: 0, // nvue下才这么计算,vue下放到computed中,否则会因为延时造成闪烁
54
54
  // #endif
55
- // #ifdef MP-TOUTIAO
56
- width: '100%',
57
- // #endif
58
55
  classes: [], // 类名集合,用于判断是否显示右边和下边框
59
56
  };
60
57
  },
@@ -69,26 +66,16 @@
69
66
  },
70
67
  // #endif
71
68
  computed: {
72
- // #ifndef APP-NVUE || MP-TOUTIAO
73
- // vue下放到computed中,否则会因为延时造成闪烁
74
- width() {
75
- if (this.parentData.col > 0) {
76
- return 100 / Number(this.parentData.col) + '%'
77
- } else {
78
- return 0;
79
- }
80
- },
81
- // #endif
82
69
  itemStyle() {
83
70
  const style = {
84
- background: this.bgColor,
85
- // #ifndef MP
86
- width: this.width
87
- // #endif
88
- // #ifdef MP
89
- width: '100%'
90
- // #endif
71
+ background: this.bgColor
91
72
  }
73
+ // #ifdef APP-NVUE
74
+ style['width'] = this.width
75
+ // #endif
76
+ // #ifndef APP-NVUE
77
+ style['width'] = '100%'
78
+ // #endif
92
79
  return deepMerge(style, addStyle(this.customStyle))
93
80
  }
94
81
  },
@@ -18,6 +18,7 @@
18
18
  为了防止type=number时,又存在password属性,type无效,此时需要设置password为undefined
19
19
  -->
20
20
  <input
21
+ ref="input-native"
21
22
  class="u-input__content__field-wrapper__field"
22
23
  :style="[inputStyle]"
23
24
  :type="type"
@@ -258,6 +259,12 @@ export default {
258
259
  this.focused = true;
259
260
  this.$emit("focus");
260
261
  },
262
+ doFocus() {
263
+ this.$refs['input-native'].focus();
264
+ },
265
+ doBlur() {
266
+ this.$refs['input-native'].blur();
267
+ },
261
268
  // 点击完成按钮时触发
262
269
  onConfirm(event) {
263
270
  this.$emit("confirm", this.innerValue);
@@ -0,0 +1,51 @@
1
+ import { defineMixin } from '../../libs/vue'
2
+
3
+ export const props = defineMixin({
4
+ props: {
5
+ // 是否开启顶部安全区适配
6
+ safeAreaInsetTop: {
7
+ type: Boolean,
8
+ default: () => true
9
+ },
10
+ // 是否固定在顶部
11
+ fixed: {
12
+ type: Boolean,
13
+ default: () => true
14
+ },
15
+ // 左边的图标
16
+ leftIcon: {
17
+ type: String,
18
+ default: 'arrow-leftward'
19
+ },
20
+ // 背景颜色
21
+ bgColor: {
22
+ type: String,
23
+ default: () => 'rgba(0,0,0,.15)'
24
+ },
25
+ // 导航栏高度
26
+ height: {
27
+ type: [String, Number],
28
+ default: () => '32px'
29
+ },
30
+ // 图标的大小
31
+ iconSize: {
32
+ type: [String, Number],
33
+ default: '20px'
34
+ },
35
+ // 图标的颜色
36
+ iconColor: {
37
+ type: String,
38
+ default: '#fff'
39
+ },
40
+ // 点击左侧区域(返回图标),是否自动返回上一页
41
+ autoBack: {
42
+ type: Boolean,
43
+ default: () => true
44
+ },
45
+ // 首页路径
46
+ homeUrl: {
47
+ type: [String],
48
+ default: ''
49
+ }
50
+ }
51
+ })
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <view class="u-navbar-mini" :class="[customClass]">
3
+ <view
4
+ class="u-navbar-mini__placeholder"
5
+ v-if="fixed"
6
+ :style="{
7
+ height: addUnit(getPx(height) + sys().statusBarHeight,'px'),
8
+ }"
9
+ ></view>
10
+ <view class="u-navbar-mini__inner" :class="[fixed && 'u-navbar-mini--fixed']">
11
+ <u-status-bar
12
+ v-if="safeAreaInsetTop"
13
+ :bgColor="bgColor"
14
+ ></u-status-bar>
15
+ <view
16
+ class="u-navbar-mini__content"
17
+ :class="[border && 'u-border-bottom']"
18
+ :style="{
19
+ height: addUnit(height),
20
+ backgroundColor: bgColor,
21
+ }"
22
+ >
23
+ <view
24
+ class="u-navbar-mini__content__left"
25
+ hover-class="u-navbar-mini__content__left--hover"
26
+ hover-start-time="150"
27
+ @tap="leftClick"
28
+ >
29
+ <slot name="left">
30
+ <up-icon
31
+ :name="leftIcon"
32
+ :size="iconSize"
33
+ :color="iconColor"
34
+ ></up-icon>
35
+ </slot>
36
+ </view>
37
+ <view style="padding: 10px 10px;">
38
+ <up-line direction="col" color="#fff" length="16px"></up-line>
39
+ </view>
40
+ <view
41
+ class="u-navbar-mini__content__center" @tap="homeClick">
42
+ <slot name="center">
43
+ <up-icon name="home" :size="iconSize" :color="iconColor"></up-icon>
44
+ </slot>
45
+ </view>
46
+ </view>
47
+ </view>
48
+ </view>
49
+ </template>
50
+
51
+ <script>
52
+ import { props } from './props';
53
+ console.log(props)
54
+ import { mpMixin } from '../../libs/mixin/mpMixin';
55
+ import { mixin } from '../../libs/mixin/mixin';
56
+ import { addUnit, addStyle, getPx, sys } from '../../libs/function/index';
57
+ /**
58
+ * NavbarMini 迷你导航栏
59
+ * @description 此组件一般用于在全屏页面中,典型的如微信小程序左上角。
60
+ * @tutorial https://ijry.github.io/uview-plus/components/navbar-mini.html
61
+ * @property {Boolean} safeAreaInsetTop 是否开启顶部安全区适配 (默认 true )
62
+ * @property {Boolean} placeholder 固定在顶部时,是否生成一个等高元素,以防止塌陷 (默认 false )
63
+ * @property {Boolean} fixed 导航栏是否固定在顶部 (默认 false )
64
+ * @property {String} leftIcon 左边返回图标的名称,只能为uView自带的图标 (默认 'arrow-left' )
65
+ * @property {String} title 导航栏标题,如设置为空字符,将会隐藏标题占位区域
66
+ * @property {String} bgColor 导航栏背景设置 (默认 '#ffffff' )
67
+ * @property {String | Number} height 导航栏高度(不包括状态栏高度在内,内部自动加上)(默认 '44px' )
68
+ * @property {String | Number} iconSize 左侧返回图标的大小(默认 20px )
69
+ * @property {String | Number} leftIconColor 左侧返回图标的颜色(默认 #303133 )
70
+ * @property {Boolean} autoBack 点击左侧区域(返回图标),是否自动返回上一页(默认 false )
71
+ * @property {Object | String} titleStyle 标题的样式,对象或字符串
72
+ * @event {Function} leftClick 点击左侧区域
73
+ * @event {Function} rightClick 点击右侧区域
74
+ * @example <u-navbar-mini @click-left="onClickBack"></u-navbar-mini>
75
+ */
76
+ export default {
77
+ name: 'u-navbar-mini',
78
+ mixins: [mpMixin, mixin, props],
79
+ data() {
80
+ return {
81
+ }
82
+ },
83
+ emits: ["leftClick", "homeClick"],
84
+ created() {
85
+ },
86
+ methods: {
87
+ addStyle,
88
+ addUnit,
89
+ sys,
90
+ getPx,
91
+ // 点击左侧区域
92
+ leftClick() {
93
+ // 如果配置了autoBack,自动返回上一页
94
+ this.$emit('leftClick')
95
+ if(this.autoBack) {
96
+ uni.navigateBack()
97
+ }
98
+ },
99
+ homeClick() {
100
+ if (this.homeUrl) {
101
+ uni.reLaunch({ url: this.homeUrl })
102
+ }
103
+ }
104
+ }
105
+ }
106
+ </script>
107
+
108
+ <style lang="scss" scoped>
109
+ @import "../../libs/css/components.scss";
110
+
111
+ .u-navbar-mini {
112
+
113
+ &__inner {
114
+ width: 180rpx;
115
+ border-radius: 20px;
116
+ overflow: hidden;
117
+ }
118
+
119
+ &--fixed {
120
+ position: fixed;
121
+ left: 20px;
122
+ right: 0;
123
+ top: 10px;
124
+ z-index: 11;
125
+ }
126
+
127
+ &__content {
128
+ @include flex(row);
129
+ padding: 0 15px;
130
+ align-items: center;
131
+ height: 44px;
132
+ background-color: #9acafc;
133
+ position: relative;
134
+ justify-content: space-between;
135
+
136
+ &__left {
137
+ @include flex(row);
138
+ align-items: center;
139
+ }
140
+
141
+ &__left {
142
+ &--hover {
143
+ opacity: 0.7;
144
+ }
145
+ }
146
+ }
147
+ }
148
+ </style>
@@ -4,7 +4,7 @@
4
4
  :class="[`u-steps-item__line--${parentData.direction}`]" :style="[lineStyle]"></view>
5
5
  <view class="u-steps-item__wrapper"
6
6
  :class="[`u-steps-item__wrapper--${parentData.direction}`, parentData.dot && `u-steps-item__wrapper--${parentData.direction}--dot`]"
7
- :style="[itemStyle]">
7
+ :style="[itemStyleInner]">
8
8
  <slot name="icon">
9
9
  <view class="u-steps-item__wrapper__dot" v-if="parentData.dot" :style="{
10
10
  backgroundColor: statusColor
@@ -117,7 +117,7 @@
117
117
  .current ? this.parentData.activeColor : this.parentData.inactiveColor
118
118
  return style
119
119
  },
120
- itemStyle() {
120
+ itemStyleInner() {
121
121
  return {
122
122
  ...this.itemStyle
123
123
  }
package/index.js CHANGED
@@ -77,11 +77,11 @@ const $u = {
77
77
  platform
78
78
  }
79
79
 
80
- // $u挂载到uni对象上
81
- uni.$u = $u
82
-
83
80
  const install = (Vue) => {
84
81
  // 同时挂载到uni和Vue.prototype中
82
+ // $u挂载到uni对象上
83
+ uni.$u = $u
84
+
85
85
  // #ifndef APP-NVUE
86
86
  // 只有vue,挂载到Vue.prototype才有意义,因为nvue中全局Vue.prototype和Vue.mixin是无效的
87
87
  Vue.config.globalProperties.$u = $u
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "uview-plus3.0重磅发布,全面的Vue3移动组件库。",
5
- "version": "3.3.11",
5
+ "version": "3.3.13",
6
6
  "description": "uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",