保存json文件到本地

This commit is contained in:
yyy 2025-02-10 09:21:56 +08:00
parent 82eff5bf84
commit ce81a142a7
2 changed files with 19 additions and 12 deletions

View File

@ -4,7 +4,7 @@ NODE_ENV=development
VITE_DEV=true
# 请求路径
VITE_BASE_URL='http://192.168.0.74:48080'
VITE_BASE_URL='http://192.168.0.66:48080'
# VITE_BASE_URL='http://192.168.0.189:48080'
# 文件上传类型server - 后端上传, client - 前端直连上传,仅支持 S3 服务

View File

@ -99,7 +99,7 @@
class="map-box-inner-dot"
@click="mapClick"
:class="state.isShowGrid ? 'grid-show' : ''"
v-if="test"
v-if="interfaceRefreshed"
>
<VueDragResizeRotate
v-for="(item, index) in allHistoryList[currentIndex]"
@ -209,10 +209,9 @@ const getMapData = async (item) => {
}
//
const test = ref(true)
const interfaceRefreshed = ref(true)
const resizeEnd = (x, y, w, h, item, index) => {
test.value = false
interfaceRefreshed.value = false
console.log('缩放', w, h)
nextTick(() => {
imgList.value[index].x = x
@ -263,13 +262,8 @@ const addEditHistory = () => {
} else {
allHistoryList.value.push(JSON.parse(JSON.stringify(imgList.value)))
currentIndex.value++
console.log(currentIndex.value)
console.log(
allHistoryList.value[currentIndex.value][currentItemIndex.value],
allHistoryList.value[currentIndex.value][currentItemIndex.value]
)
}
test.value = true
interfaceRefreshed.value = true
console.log(allHistoryList.value, 'allHistoryList')
}
@ -544,6 +538,20 @@ const toolbarClick = (item) => {
saveMap()
break
case 3:
// json 访
const jsonString = JSON.stringify(allHistoryList.value[currentIndex.value], null, 2)
const blob = new Blob([jsonString], { type: 'application/json' })
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = 'mapJson.json'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
URL.revokeObjectURL(url)
message.success('下载成功')
break
case 4:
break
@ -583,7 +591,6 @@ const toolbarClick = (item) => {
case 13:
//
textFormToolDialogRef.value.open()
// if (toolbarTypeIndex.value === 13) {
// state.cursorStyle = `url('${cursorCollection.input}'),auto`
// } else {