mine-h5-ui
Version:
一款轻量级、模块化基于 Vue3.x 的 H5 前端 UI 组件库 👍
29 lines (28 loc) • 611 B
JavaScript
import { ref as s, watch as l } from "vue";
import i from "../node_modules/html2canvas/dist/html2canvas.esm.js";
const f = (o, n) => {
const c = s(), a = (t) => {
n("click", t);
}, r = (t) => {
const e = document.createElement("a");
e.href = t, e.download = `${o.imageName}.png`, e.click();
}, m = () => {
i(c.value).then((t) => {
const e = t.toDataURL();
o.allowDown && r(e), n("end", e, t);
});
};
return l(
() => o.start,
(t) => {
t && m();
},
{ immediate: !0 }
), {
screenshotRef: c,
onClick: a
};
};
export {
f as useHandler
};