Browse Source

上传文件,移动端无法显示无法修改bug修复,无文件时显示"无"

yunpan
liwenxuan 2 months ago
parent
commit
31955a0abb
  1. 1
      src/components/formTable/index.vue
  2. 63
      src/components/lowCode/assistant/uploadPage.vue

1
src/components/formTable/index.vue

@ -137,6 +137,7 @@ const unWatch2 = watch(
) )
// model // model
const forEachGetFormModel = (list: FormList[], obj: any) => { const forEachGetFormModel = (list: FormList[], obj: any) => {
//console.log(list)
list.forEach((item: any) => { list.forEach((item: any) => {
if (['table', 'flex'].includes(item.type)) { if (['table', 'flex'].includes(item.type)) {
obj[item.name] = jsonParseStringify(item.tableData) obj[item.name] = jsonParseStringify(item.tableData)

63
src/components/lowCode/assistant/uploadPage.vue

@ -15,6 +15,8 @@ import {
constGetControlByName constGetControlByName
} from '@/api/lowCode/utils'; } from '@/api/lowCode/utils';
import { computed } from 'vue';
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
modelValue?: string modelValue?: string
@ -137,11 +139,37 @@ const uploadSuccess = (response: any, uploadFile: any, uploadFiles: any) => {
// console.log("uploadSuccess===>",control.value) // console.log("uploadSuccess===>",control.value)
// console.log("uploadSuccess=fileList==>",fileList) // console.log("uploadSuccess=fileList==>",fileList)
} }
const imgAry = computed({
get: () => {
if (
props.imgList != "" &&
props.imgList != null &&
props.imgList != undefined &&
props.imgList != "undefined"
) {
// let zj = props.imgList
// let img = zj.Split(",");
let arr = props.imgList.match(/[^,]+/g);
console.log("文件列表", arr);
return arr;
} else {
return [];
}
},
});
function openUrl1(url:string) {
window.open(url, '_blank')
}
</script> </script>
<template><!-- {'{types}} --> <template><!-- {'{types}} -->
<div style="width: 100%; <div style="width: 100%;
display: inline;"> display: inline;">
<el-upload <el-upload
v-if="props.types!=3"
v-bind="props.control" v-bind="props.control"
:action="uploadUrl" :action="uploadUrl"
:name="props.name" :name="props.name"
@ -172,6 +200,19 @@ const uploadSuccess = (response: any, uploadFile: any, uploadFiles: any) => {
</div> </div>
</template> </template>
</el-upload> </el-upload>
<div v-else>
<span v-if="fileList.length==0"></span>
<div v-for="item in fileList">
<!-- <el-link :underline="false" :href="item.url" target="_blank" style="color: blue;">{{ item.url }}</el-link> -->
<!-- <br /> -->
<div v-if="types==3" class="url-container" @click="openUrl1(item.url)">
<span class="url-content">
{{ item.url }}
</span>
</div>
</div>
</div>
</div> </div>
</template> </template>
<style lang='scss' > <style lang='scss' >
@ -185,4 +226,26 @@ const uploadSuccess = (response: any, uploadFile: any, uploadFiles: any) => {
transition: all .5s cubic-bezier(.55,0,.1,1); transition: all .5s cubic-bezier(.55,0,.1,1);
} }
.url-container {
/* 容器样式(保持点击和下划线等特性) */
cursor: pointer;
color: #0000EE;
text-decoration: underline;
/* 可选:限制容器最大宽度,避免span无限拉伸 */
max-width: 100%;
}
.url-content {
/* 1. 自定义触发溢出的宽度(例如300px) */
width: 100%;
/* 2. 块级显示,确保width生效 */
display: inline-block;
/* 3. 超出宽度后自动换行(默认行为,可省略) */
white-space: normal;
/* 4. 处理长英文/数字不换行问题(可选) */
word-wrap: break-word;
text-decoration:underline;
}
</style> </style>
Loading…
Cancel
Save