sh-view 2.4.6 → 2.4.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sh-view",
3
- "version": "2.4.6",
3
+ "version": "2.4.8",
4
4
  "description": "基于vxe-table二次封装",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
@@ -1,29 +1,7 @@
1
1
  <template>
2
2
  <vxe-modal
3
- :id="id"
4
3
  ref="modalRef"
5
- v-model="modalVisible"
6
- :title="title"
7
- :size="size"
8
- :class-name="className"
9
- :width="width"
10
- :height="height"
11
- :type="type"
12
- :status="status"
13
- :loading="loading"
14
- :destroy-on-close="destroyOnClose"
15
- :transfer="transfer"
16
- :fullscreen="fullscreen"
17
- :show-header="showHeader"
18
- :show-zoom="showZoom"
19
- :show-close="showClose"
20
- :show-footer="showFooter"
21
- :resize="resize"
22
- :mask="mask"
23
- :mask-closable="maskClosable"
24
- :esc-closable="escClosable"
25
- :position="position"
26
- :before-hide-method="beforeHideMethod"
4
+ v-bind="modalConfig"
27
5
  @show="onModalShow"
28
6
  @hide="onModalHide"
29
7
  @zoom="onModalZoom"
@@ -49,7 +27,7 @@
49
27
  </template>
50
28
 
51
29
  <script>
52
- import { defineComponent, watch, ref } from 'vue'
30
+ import { defineComponent, watch, ref, computed, getCurrentInstance } from 'vue'
53
31
  export default defineComponent({
54
32
  name: 'ShModal',
55
33
  props: {
@@ -149,9 +127,15 @@ export default defineComponent({
149
127
  },
150
128
  emits: ['update:modelValue', 'show', 'hide', 'zoom', 'confirm', 'close'],
151
129
  setup(props, context) {
130
+ const { proxy } = getCurrentInstance()
131
+ const { $vUtils } = proxy
152
132
  const { emit, slots } = context
153
133
  const modalRef = ref()
154
- const modalVisible = ref(props.modelValue)
134
+
135
+ const modalConfig = computed(() => {
136
+ let modelProps = $vUtils.omit(props, ['readonly', 'confirmButtonText', 'cancelButtonText'])
137
+ return $vUtils.omit(modelProps, val => val === undefined)
138
+ })
155
139
 
156
140
  // 弹窗显示回调
157
141
  const onModalShow = () => {
@@ -176,22 +160,16 @@ export default defineComponent({
176
160
  }
177
161
 
178
162
  watch(
179
- () => props.modelValue,
180
- value => {
181
- modalVisible.value = value
182
- }
183
- )
184
- watch(
185
- () => modalVisible.value,
163
+ () => modalConfig.value.modelValue,
186
164
  value => {
187
165
  if (!value) onModalClose()
188
166
  }
189
167
  )
190
168
 
191
169
  return {
192
- modalRef,
193
170
  slots,
194
- modalVisible,
171
+ modalRef,
172
+ modalConfig,
195
173
  onModalShow,
196
174
  onModalHide,
197
175
  onModalZoom,
@@ -137,7 +137,7 @@ export default defineComponent({
137
137
  let outerWidth = splitRef.value[offsetSize.value]
138
138
  let value = valueIsPx.value ? `${parseFloat(oldOffset.value) + offset}px` : px2percent(outerWidth * oldOffset.value + offset, outerWidth)
139
139
  let anotherValue = getAnotherOffset(value)
140
- if (parseFloat(value) <= parseFloat(computedMin.value)) value = getMax(value, computedMin.value)
140
+ if (parseFloat(value) <= parseFloat(computedMin.value)) value = getMin(value, computedMin.value)
141
141
  if (parseFloat(anotherValue) <= parseFloat(computedMax.value)) value = getAnotherOffset(getMax(anotherValue, computedMax.value))
142
142
  e.atMin = currentValue.value === computedMin.value
143
143
  e.atMax = valueIsPx.value ? getAnotherOffset(currentValue.value) === computedMax.value : getAnotherOffset(currentValue.value).toFixed(5) === computedMax.value.toFixed(5)
@@ -12,7 +12,7 @@
12
12
  </template>
13
13
 
14
14
  <script>
15
- import { defineComponent, getCurrentInstance } from 'vue'
15
+ import { defineComponent, getCurrentInstance, ref } from 'vue'
16
16
  import cellProps from '../mixin/cell-props'
17
17
  import cellHooks from '../mixin/cell-hooks'
18
18
  export default defineComponent({