在main.js中
app.config.globalProperties.rootUrl = 'https://xxx.com/'
然后在我需要的页面中引入
<script lang="ts" setup>
import { getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance() as any
</script>
然后在我需要的地方
<el-upload
:action="`${proxy.rootUrl}supply/upload`"
list-type="picture-card"
:on-success="handleAvatarSuccess"
v-model:file-list="fileListimg"
>
</el-upload>
或者在ts的地方中引用
const handlePreview: UploadProps['onPreview'] = (uploadFile) => {
location.href=proxy.rootUrl+uploadFile.name
}