Commit c0a191d2 by hank

getHosturl

parent e80445bf
......@@ -69,3 +69,14 @@ export function formatTime(time, option) {
)
}
}
// 获取hosturl
export function getHostUrl(frameUrl, dataUrl) {
if (String(dataUrl).indexOf('http') !== -1) {
return dataUrl
} else {
let arr = frameUrl.split('/')
arr.splice(-1, 2)
let host = arr.join('/') + '/'
return host + dataUrl
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@
<img
v-if="item.type === 'image'"
class="image"
:src="schemaData[item.dataKey].value"
:src="getHostUrl(schemaData[item.dataKey].value)"
alt
/>
<input
......@@ -83,7 +83,7 @@
<script>
import { upload } from "@/api/api";
import { getHostUrl } from '@/utils/index'
export default {
name: "editMenu",
props: {
......@@ -91,6 +91,10 @@ export default {
type: Array,
default: () => []
},
frameUrl: {
type: String,
default: ''
},
schemaData: {
type: Object,
default: () => {}
......@@ -144,6 +148,9 @@ export default {
}
console.log(item);
},
getHostUrl( dataUrl) {
return getHostUrl(this.frameUrl, dataUrl)
},
uploadAfter(file) {
upload(file.file)
.then(res => {
......
......@@ -63,6 +63,7 @@
v-if="loaded "
:itemList="templateData.listData[currentPage].itemList"
:schemaData="templateData.listData[currentPage].schemaData"
:frameUrl="templateData.frameUrl"
@setList="setList"
></editMenu>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment