Files
NexQuant/web/src/components/saveImage.vue
T
XianBW 14395488b9 feat: add a web UI server (#1345)
* update rdagent cmd

* fix log error message

* use multiProcessing.Process instead of subprocess.Popen

* add traces to gitignore

* add user interactor in RDLoop (finance scenarios)

* add interactor (feedback, hypothesis) for quant scens

* fix the test_end in qlib conf

* add features init config, general instruction to qlib scenarios

* set base features for based exp

* fix bug when combine factors

* move traces folder to git_ignore_folder

* fix bug in features init

* fix quant interact bug

* fix logger warning error

* bug fixes

* modify rdagent logger, now it can set file output

* adjust cli functions and fix logger bug

* fix server port transport problem

* update server_ui in cli

* add web code

* fix CI problem

* black fix

* update web ui README

* update README

* update readme
2026-03-18 14:04:52 +08:00

40 lines
840 B
Vue

<template>
<div>
<div id="capture" ref="capture">
<!-- 这里是你想要保存为图片的HTML内容 -->
<h1>Hello World</h1>
</div>
<button @click="saveAsImage">保存为图片</button>
</div>
</template>
<script>
import { ref } from "vue";
import html2canvas from "html2canvas";
export default {
setup() {
const capture = ref(null);
const saveAsImage = async () => {
try {
const canvas = await html2canvas(capture.value);
const img = canvas.toDataURL("image/png");
const link = document.createElement("a");
link.href = img;
link.download = "capture.png";
link.click();
} catch (error) {
console.error("Error capturing the image:", error);
}
};
return {
capture,
saveAsImage,
};
},
};
</script>