UNPKG

double-ui-vue

Version:
90 lines (89 loc) 1.97 kB
import { defineComponent, createVNode } from "vue"; var index = ""; var style = ""; const MiniLoading = defineComponent({ name: "MiniLoading", props: { color: { type: String, default: "#fff" } }, setup(props) { return () => createVNode("div", { "class": "d-min-loading" }, [createVNode("svg", { "class": "d-min-loading-line", "viewBox": "0 0 16 16", "xmlns": "http://www.w3.org/2000/svg" }, [createVNode("path", { "d": "M9,1 A7,7 0 0,1 15,7", "fill": "none", "stroke-width": "1", "stroke": props.color }, null)])]); } }); const Button = defineComponent({ name: "DButton", props: { type: { type: String, default: "default" }, size: { type: String, default: "medium" }, disabled: { type: Boolean, default: false }, width: { type: [String, Number], default: "" }, htmlType: { type: String, default: "button" }, loading: { type: Boolean, default: false } }, emits: ["click"], setup(props, { emit, slots }) { const clickHandle = () => { emit("click"); }; return () => { const { type, size, disabled, width, htmlType, loading } = props; return createVNode("button", { "type": htmlType, "class": ["d-button", `d-button-${type}`, `d-button-${size}`, `d-button-${disabled ? "disabled" : "normal"}`], "style": { width: `${width}px` }, "onClick": clickHandle }, [createVNode("section", { "class": "d-button-content" }, [loading && createVNode("span", { "class": "d-button-loading" }, [createVNode(MiniLoading, null, null)]), createVNode("span", { "class": "d-button-text" }, [slots.default && slots.default()])])]); }; } }); export { Button as default };