@neatui/vue 2.7.0 → 2.7.1
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
|
<template>
|
|
2
2
|
<div ui-flex="row lm :wrap" class="neatui-upload mb-sm-sub mr-sm-sub" v-bind="{ ...attrs }">
|
|
3
|
-
<div v-for="(file, idx) in state.files" :key="idx" ui-flex="col cm" class="flex-fixed bg-fore n-sl w-ms h-ms b-solid bk-
|
|
3
|
+
<div v-for="(file, idx) in state.files" :key="idx" ui-flex="col cm" class="flex-fixed bg-fore n-sl w-ms h-ms b-solid bk-case b-xs r-sm pr">
|
|
4
4
|
<!-- 删除按钮 -->
|
|
5
5
|
<div class="pa ot-ss or-ss bg-fore co-risk lh-xs r-xl parent-hover:show" @click="remove(idx)">
|
|
6
6
|
<svg class="block" viewBox="0 0 1024 1024" style="width: 1em; height: 1em">
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
<!-- 上传按钮 -->
|
|
164
164
|
<div v-if="showUploadButton">
|
|
165
165
|
<slot>
|
|
166
|
-
<label ui-flex="row cm" ui-form="@a type:upload tips:hover" :class="`upload w-ms h-ms n-sl bg-fore b-solid bk-
|
|
166
|
+
<label ui-flex="row cm" ui-form="@a type:upload tips:hover" :class="`upload w-ms h-ms n-sl bg-fore b-solid bk-case b-xs r-sm ${uploadClass}`" :style="uploadStyle">
|
|
167
167
|
<div v-if="tips" ui-form-tips>
|
|
168
168
|
{{ tips }}
|
|
169
169
|
</div>
|
|
@@ -179,37 +179,22 @@
|
|
|
179
179
|
</label>
|
|
180
180
|
</slot>
|
|
181
181
|
</div>
|
|
182
|
-
<Layer :id="layerId" am="as"></Layer>
|
|
183
182
|
</div>
|
|
184
183
|
</template>
|
|
185
184
|
<script setup lang="ts">
|
|
186
|
-
import { reactive,
|
|
187
|
-
import { Image } from '../display';
|
|
188
|
-
import draggable from 'vuedraggable';
|
|
185
|
+
import { reactive, watch, onUnmounted, computed } from 'vue';
|
|
189
186
|
import Compressor from 'compressorjs';
|
|
190
|
-
import { Layer, LayerById } from '../basic';
|
|
191
|
-
import { isArray, isFunction } from '@fekit/utils';
|
|
192
|
-
|
|
193
|
-
const layerId = Math.random().toString(36).slice(-6);
|
|
194
187
|
|
|
195
188
|
interface Props {
|
|
196
189
|
modelValue?: string | any[];
|
|
197
|
-
// 文件数量限制
|
|
198
190
|
max?: number;
|
|
199
191
|
attrs?: object;
|
|
200
192
|
uploadClass?: string;
|
|
201
193
|
uploadStyle?: string;
|
|
202
|
-
|
|
203
|
-
tips?: string; // 提示文案
|
|
204
|
-
// 文件类型
|
|
194
|
+
tips?: string;
|
|
205
195
|
accept?: string | 'image/*' | 'video/*' | 'audio/*';
|
|
206
|
-
// 是否需要抠图处理
|
|
207
|
-
crop?: boolean;
|
|
208
|
-
// 请求上传接口
|
|
209
196
|
upload?: (formData: FormData) => Promise<any>;
|
|
210
|
-
// 文件大小限制(MB)
|
|
211
197
|
maxSize?: number;
|
|
212
|
-
// 是否启用图片压缩
|
|
213
198
|
compress?: boolean;
|
|
214
199
|
}
|
|
215
200
|
|
|
@@ -217,15 +202,13 @@
|
|
|
217
202
|
modelValue: '',
|
|
218
203
|
uploadClass: '',
|
|
219
204
|
uploadStyle: '',
|
|
220
|
-
id: '',
|
|
221
205
|
attrs: () => ({}),
|
|
222
|
-
tips: '',
|
|
223
|
-
accept: '*',
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
max: 0
|
|
206
|
+
tips: '', // 提示文案
|
|
207
|
+
accept: '*', // 文件类型
|
|
208
|
+
upload: async () => null, // 请求上传接口
|
|
209
|
+
maxSize: 10, // 文件大小限制(MB)
|
|
210
|
+
compress: true, // 是否启用图片压缩
|
|
211
|
+
max: 0 // 文件数量限制
|
|
229
212
|
});
|
|
230
213
|
|
|
231
214
|
interface UploadFile {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
</template>
|
|
44
44
|
</IFollowView>
|
|
45
45
|
<button class="bg-fore" ui-btn="@a s case :border" @click="fResetLimit">{{ words['common.reset'] || '重置' }}</button>
|
|
46
|
+
<button class="bg-fore" ui-btn="@a s case :border" @click="fSearch">{{ words['common.search'] || '搜索' }}</button>
|
|
46
47
|
</div>
|
|
47
48
|
</div>
|
|
48
49
|
</template>
|
|
@@ -91,6 +92,11 @@
|
|
|
91
92
|
tools: false
|
|
92
93
|
});
|
|
93
94
|
|
|
95
|
+
// 定义emit事件
|
|
96
|
+
const emits = defineEmits<{
|
|
97
|
+
search: [param: any];
|
|
98
|
+
}>();
|
|
99
|
+
|
|
94
100
|
// 内部数据
|
|
95
101
|
const state: any = reactive({
|
|
96
102
|
name: computed(() => 'confs' + route.path?.replace(/\//g, '_')),
|
|
@@ -173,5 +179,16 @@
|
|
|
173
179
|
delete state.param[key];
|
|
174
180
|
}
|
|
175
181
|
}
|
|
182
|
+
// 触发搜索事件
|
|
183
|
+
emits('search', state.param);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// 搜索功能
|
|
187
|
+
const fSearch = () => {
|
|
188
|
+
// 重置页码
|
|
189
|
+
if (state.param.page) {
|
|
190
|
+
state.param.page = 1;
|
|
191
|
+
}
|
|
192
|
+
emits('search', state.param);
|
|
176
193
|
};
|
|
177
194
|
</script>
|