@scalar/api-reference
Version:
Generate beautiful API references from OpenAPI documents
60 lines (59 loc) • 2.56 kB
JavaScript
import { defineComponent, createElementBlock, createCommentVNode, openBlock, normalizeClass, withModifiers, createElementVNode, createVNode, withCtx, createTextVNode } from "vue";
import Badge from "../../../components/Badge/Badge.vue.js";
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "DownloadLink",
props: {
documentDownloadType: {},
eventBus: {}
},
setup(__props) {
const handleDownloadClick = (format) => {
__props.eventBus.emit("ui:download:document", { format });
};
return (_ctx, _cache) => {
return ["yaml", "json", "both", "direct"].includes(__props.documentDownloadType) ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(["download-container group", {
"download-both": __props.documentDownloadType === "both"
}])
}, [
__props.documentDownloadType === "json" || __props.documentDownloadType === "both" || __props.documentDownloadType === "direct" ? (openBlock(), createElementBlock("button", {
key: 0,
class: "download-button",
type: "button",
onClick: _cache[0] || (_cache[0] = withModifiers(
() => handleDownloadClick(
__props.documentDownloadType === "direct" ? "direct" : "json"
),
["prevent"]
))
}, [
_cache[3] || (_cache[3] = createElementVNode("span", null, " Download OpenAPI Document ", -1)),
createVNode(Badge, { class: "extension hidden group-hover:flex" }, {
default: withCtx(() => [..._cache[2] || (_cache[2] = [
createTextVNode("json", -1)
])]),
_: 1
})
])) : createCommentVNode("", true),
__props.documentDownloadType === "yaml" || __props.documentDownloadType === "both" ? (openBlock(), createElementBlock("button", {
key: 1,
class: "download-button",
type: "button",
onClick: _cache[1] || (_cache[1] = withModifiers(() => handleDownloadClick("yaml"), ["prevent"]))
}, [
_cache[5] || (_cache[5] = createElementVNode("span", null, " Download OpenAPI Document ", -1)),
createVNode(Badge, { class: "extension hidden group-hover:flex" }, {
default: withCtx(() => [..._cache[4] || (_cache[4] = [
createTextVNode("yaml", -1)
])]),
_: 1
})
])) : createCommentVNode("", true)
], 2)) : createCommentVNode("", true);
};
}
});
export {
_sfc_main as default
};