Commit c0a191d2 by hank

getHosturl

parent e80445bf
...@@ -69,3 +69,14 @@ export function formatTime(time, option) { ...@@ -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 @@ ...@@ -15,7 +15,7 @@
<img <img
v-if="item.type === 'image'" v-if="item.type === 'image'"
class="image" class="image"
:src="schemaData[item.dataKey].value" :src="getHostUrl(schemaData[item.dataKey].value)"
alt alt
/> />
<input <input
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<script> <script>
import { upload } from "@/api/api"; import { upload } from "@/api/api";
import { getHostUrl } from '@/utils/index'
export default { export default {
name: "editMenu", name: "editMenu",
props: { props: {
...@@ -91,6 +91,10 @@ export default { ...@@ -91,6 +91,10 @@ export default {
type: Array, type: Array,
default: () => [] default: () => []
}, },
frameUrl: {
type: String,
default: ''
},
schemaData: { schemaData: {
type: Object, type: Object,
default: () => {} default: () => {}
...@@ -144,6 +148,9 @@ export default { ...@@ -144,6 +148,9 @@ export default {
} }
console.log(item); console.log(item);
}, },
getHostUrl( dataUrl) {
return getHostUrl(this.frameUrl, dataUrl)
},
uploadAfter(file) { uploadAfter(file) {
upload(file.file) upload(file.file)
.then(res => { .then(res => {
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
v-if="loaded " v-if="loaded "
:itemList="templateData.listData[currentPage].itemList" :itemList="templateData.listData[currentPage].itemList"
:schemaData="templateData.listData[currentPage].schemaData" :schemaData="templateData.listData[currentPage].schemaData"
:frameUrl="templateData.frameUrl"
@setList="setList" @setList="setList"
></editMenu> ></editMenu>
</div> </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