@scalar/api-client
Version:
the open source API testing client
37 lines (36 loc) • 1.14 kB
JavaScript
import { defineComponent as l, computed as p, createElementBlock as a, openBlock as i, withModifiers as d, createVNode as f, createElementVNode as t, unref as m } from "vue";
import { ScalarIcon as c } from "@scalar/components";
import { getMediaTypeConfig as u } from "../consts/mediaTypes.js";
const x = ["download", "href"], h = /* @__PURE__ */ l({
__name: "ResponseBodyDownload",
props: {
href: {},
type: {},
filename: {}
},
setup(s) {
const n = s, r = p(() => {
const o = u(n.type ?? "")?.extension ?? ".unknown";
return n.filename ? n.filename : `response${o}`;
});
return (o, e) => (i(), a("a", {
class: "text-c-3 text-xxs hover:bg-b-3 flex items-center gap-1 rounded px-1.5 py-0.5 no-underline",
download: `${r.value}`,
href: o.href,
onClick: e[0] || (e[0] = d(() => {
}, ["stop"]))
}, [
f(m(c), {
icon: "Download",
size: "xs"
}),
e[1] || (e[1] = t("span", null, [
t("span", null, "Download"),
t("span", { class: "sr-only" }, "Response Body")
], -1))
], 8, x));
}
});
export {
h as default
};