全屏展示

This commit is contained in:
2025-03-06 18:03:53 +08:00
parent 81aea950c6
commit 8b22e91f78
2 changed files with 12 additions and 1 deletions

0
public/usercontent.html Normal file
View File

View File

@@ -4,7 +4,10 @@
<Icon icon="noto:eyes" :width="20"></Icon> <Icon icon="noto:eyes" :width="20"></Icon>
<n-text class="titleText">预览</n-text> <n-text class="titleText">预览</n-text>
</n-flex> </n-flex>
<n-flex>
<n-button quaternary @click="download" :disabled="!showDL">下载</n-button> <n-button quaternary @click="download" :disabled="!showDL">下载</n-button>
<n-button quaternary @click="open">展示</n-button>
</n-flex>
</n-flex> </n-flex>
<iframe class="iframe" ref="iframe"></iframe> <iframe class="iframe" ref="iframe"></iframe>
</template> </template>
@@ -57,6 +60,14 @@ function download() {
URL.revokeObjectURL(url) URL.revokeObjectURL(url)
} }
function open() {
const newTab = window.open("/usercontent.html")
if (!newTab) return
newTab.document.open()
newTab.document.write(getContent())
newTab.document.close()
}
watchDebounced([html, css, js], preview, { debounce: 500, maxWait: 1000 }) watchDebounced([html, css, js], preview, { debounce: 500, maxWait: 1000 })
onMounted(preview) onMounted(preview)
</script> </script>