Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2024-06-17 10:36:49 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
02c793b39c06960f05130fecd224514bd6f1c040
02c793b3
1 parent
53ac6dfb
fix 上传文件和图片组件,非只读模式有默认值时,显示存在的数据方便操作
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
src/components/FileUploaderField/index.vue
src/components/ImageUploaderField/index.vue
src/components/FileUploaderField/index.vue
View file @
02c793b
<!--
* @Date: 2022-08-31 16:16:49
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-1
3 16:07:24
* @LastEditTime: 2024-06-1
7 09:57:29
* @FilePath: /data-table/src/components/FileUploaderField/index.vue
* @Description: 文件上传控件
-->
...
...
@@ -24,7 +24,7 @@
style="padding-left: 1rem; margin-bottom: 0.5rem"
>
<p style="font-size: 1rem; word-break: break-all; margin-right: 0.75rem;">
<span>{{ index + 1 }}. {{ file.
file
name }} {{ (file.size / 1024 / 1024).toFixed(2) }}MB</span>
<span>{{ index + 1 }}. {{ file.name }} {{ (file.size / 1024 / 1024).toFixed(2) }}MB</span>
<span style="color: #e32525; font-size: 0.85rem" @click="beforeDelete(file)">移除</span>
</p>
...
...
@@ -98,7 +98,14 @@ const HideShow = computed(() => {
})
const emit = defineEmits(["active"]);
const show_empty = ref(false);
const default_file = ref(props.item.component_props.default)
const default_file = ref(props.item.component_props.default);
onMounted(() => {
// 非只读模式并且有默认值时
if (!props.item.component_props.readonly && props.item.component_props.default) {
fileList.value = default_file.value;
}
})
// 文件类型中文页面显示
const type_text = computed(() => {
...
...
src/components/ImageUploaderField/index.vue
View file @
02c793b
<!--
* @Date: 2022-08-31 16:16:49
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-17
09:31:57
* @LastEditTime: 2024-06-17
10:04:35
* @FilePath: /data-table/src/components/ImageUploaderField/index.vue
* @Description: 图片上传控件
-->
...
...
@@ -93,9 +93,17 @@ const default_tmp = ref(props.item.component_props.default)
const default_list = ref([]);
onMounted(() => {
// 默认图片显示
if (default_tmp.value && default_tmp.value.length) {
default_list.value = default_tmp.value.map(item => item.url)
// 非只读模式并且有默认值时
if (!props.item.component_props.readonly) {
// 默认图片显示
if (default_tmp.value && default_tmp.value.length) {
fileList.value = default_tmp.value
}
} else {
// 默认图片显示
if (default_tmp.value && default_tmp.value.length) {
default_list.value = default_tmp.value.map(item => item.url)
}
}
})
...
...
Please
register
or
login
to post a comment