uview-plus 3.5.5 → 3.5.15

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.
@@ -39,5 +39,6 @@ export default {
39
39
  disabledColor: '',
40
40
  placeholder: t("up.common.pleaseChoose"),
41
41
  inputProps: {},
42
+ pageInline: false
42
43
  }
43
44
  }
@@ -163,6 +163,11 @@ export const props = defineMixin({
163
163
  defaultIndex: {
164
164
  type: Array,
165
165
  default: () => defProps.datetimePicker.defaultIndex
166
+ },
167
+ // 是否页面内展示
168
+ pageInline:{
169
+ type: Boolean,
170
+ default: () => defProps.datetimePicker.pageInline
166
171
  }
167
172
  }
168
173
  })
@@ -9,13 +9,13 @@
9
9
  v-model="inputValue"
10
10
  v-bind="inputPropsInner"
11
11
  ></up-input>
12
- <div class="input-cover">
13
- </div>
12
+ <view class="input-cover">
13
+ </view>
14
14
  </slot>
15
15
  </view>
16
16
  <u-picker
17
17
  ref="picker"
18
- :show="show || (hasInput && showByClickInput)"
18
+ :show="pageInline || show || (hasInput && showByClickInput)"
19
19
  :popupMode="popupMode"
20
20
  :closeOnClickOverlay="closeOnClickOverlay"
21
21
  :columns="columns"
@@ -29,6 +29,7 @@
29
29
  :cancelColor="cancelColor"
30
30
  :confirmColor="confirmColor"
31
31
  :toolbarRightSlot="toolbarRightSlot"
32
+ :pageInline="pageInline"
32
33
  @close="close"
33
34
  @cancel="cancel"
34
35
  @confirm="confirm"
@@ -44,7 +44,12 @@ export const props = defineMixin({
44
44
  // 是否显示清除控件
45
45
  clearable: {
46
46
  type: Boolean,
47
- default: () => defProps.input.clearable
47
+ default: false
48
+ },
49
+ // 是否仅在聚焦时显示清除控件
50
+ onlyClearableOnFocused: {
51
+ type: Boolean,
52
+ default: true
48
53
  },
49
54
  // 是否密码类型
50
55
  password: {
@@ -205,8 +205,15 @@ export default {
205
205
  },
206
206
  // 是否显示清除控件
207
207
  isShowClear() {
208
- const { clearable, readonly, focused, innerValue } = this;
209
- return !!clearable && !readonly && !!focused && innerValue !== "";
208
+ const { clearable, readonly, focused, innerValue, onlyClearableOnFocused } = this;
209
+ if (!clearable || readonly) {
210
+ return false;
211
+ }
212
+ if (onlyClearableOnFocused) {
213
+ return !!focused && innerValue !== "";
214
+ } else {
215
+ return innerValue !== "";
216
+ }
210
217
  },
211
218
  // 组件的类名
212
219
  inputClass() {
@@ -0,0 +1,19 @@
1
+ export default {
2
+ props: {
3
+ // PDF文件地址
4
+ src: {
5
+ type: String,
6
+ default: ''
7
+ },
8
+ // 组件高度
9
+ height: {
10
+ type: String,
11
+ default: '700px'
12
+ },
13
+ // pdfjs资源域名
14
+ baseUrl: {
15
+ type: String,
16
+ default: 'https://uview-plus.jiangruyi.com/h5'
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <view class="up-pdf-reader" :style="{ height: height }">
3
+ <web-view :fullscreen="false"
4
+ :src="viewerUrl" :style="{ width: '750rpx', height: height }"
5
+ :webview-styles="{ width: '750rpx', height: height }"
6
+ frameborder="0"
7
+ ></web-view>
8
+ </view>
9
+ </template>
10
+
11
+ <script>
12
+ import props from './props.js';
13
+
14
+ /**
15
+ * pdfReader PDF阅读器
16
+ * @description 基于pdf.js的PDF阅读器组件
17
+ * @tutorial https://uview-plus.jiangruyi.com/components/pdfReader.html
18
+ * @property {String} src PDF文件地址
19
+ * @property {String} height 组件高度,默认为'700px'
20
+ * @property {String} pdfjsDomain pdfjs资源域名,默认为'https://uview-plus.jiangruyi.com/h5'
21
+ * @example <up-pdf-reader src="https://example.com/file.pdf"></up-pdf-reader>
22
+ */
23
+ export default {
24
+ name: 'up-pdf-reader',
25
+ mixins: [props],
26
+ data() {
27
+ return {
28
+ baseUrlInner: 'https://uview-plus.jiangruyi.com/h5',
29
+ viewerUrl: ''
30
+ }
31
+ },
32
+ watch: {
33
+ baseUrl: function (val) {
34
+ this.baseUrl = val;
35
+ },
36
+ src: function (val) {
37
+ this.viewerUrl = `${this.baseUrlInner}/static/pdfjs/web/viewer.html?file=` + encodeURIComponent(val);
38
+ }
39
+ },
40
+ mounted() {
41
+ if (this.baseUrl) {
42
+ this.baseUrlInner = this.baseUrl;
43
+ }
44
+ this.viewerUrl = `${this.baseUrlInner}/static/pdfjs/web/viewer.html?file=` + encodeURIComponent(this.src);
45
+ }
46
+ }
47
+ </script>
48
+
49
+ <style lang="scss" scoped>
50
+ .up-pdf-reader {
51
+ }
52
+ </style>
@@ -36,6 +36,7 @@ export default {
36
36
  bgColor: '',
37
37
  round: 0,
38
38
  duration: 300,
39
- overlayOpacity: 0.5
39
+ overlayOpacity: 0.5,
40
+ pageInline: false
40
41
  }
41
42
  }
@@ -142,6 +142,11 @@ export const props = defineMixin({
142
142
  overlayOpacity: {
143
143
  type: [Number, String],
144
144
  default: () => defProps.picker.overlayOpacity
145
- }
145
+ },
146
+ // 是否页面内展示
147
+ pageInline:{
148
+ type: Boolean,
149
+ default: () => defProps.picker.pageInline
150
+ }
146
151
  }
147
152
  })
@@ -11,7 +11,7 @@
11
11
  v-model="inputLabel"
12
12
  v-bind="inputPropsInner">
13
13
  </up-input>
14
- <div class="input-cover"></div>
14
+ <view class="input-cover"></view>
15
15
  </view>
16
16
  <u-popup
17
17
  :show="show || (hasInput && showByClickInput)"
@@ -20,6 +20,7 @@
20
20
  :bgColor="bgColor"
21
21
  :round="round"
22
22
  :duration="duration"
23
+ :pageInline="pageInline"
23
24
  :overlayOpacity="overlayOpacity"
24
25
  @close="closeHandler"
25
26
  >
@@ -80,7 +80,7 @@ export const props = defineMixin({
80
80
  // 是否页面内展示
81
81
  pageInline:{
82
82
  type: Boolean,
83
- default: defProps.popup.pageInline
84
- },
83
+ default: () => defProps.popup.pageInline
84
+ }
85
85
  }
86
86
  })