"use strict"; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); const common_vendor = require("../../../../common/vendor.js"); if (!Array) { const _easycom_wd_icon2 = common_vendor.resolveComponent("wd-icon"); _easycom_wd_icon2(); } const _easycom_wd_icon = () => "../wd-icon/wd-icon.js"; if (!Math) { _easycom_wd_icon(); } const __default__ = { name: "wd-button", options: { addGlobalClass: true, virtualHost: true, styleIsolation: "shared" } }; const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent(__spreadProps(__spreadValues({}, __default__), { props: common_vendor.buttonProps, emits: [ "click", "getuserinfo", "contact", "getphonenumber", "error", "launchapp", "opensetting", "chooseavatar", "agreeprivacyauthorization" ], setup(__props, { emit: __emit }) { const loadingIcon = (color = "#4D80F0", reverse = true) => { return ``; }; const props = __props; const emit = __emit; const hoverStartTime = common_vendor.ref(20); const hoverStayTime = common_vendor.ref(70); const loadingIconSvg = common_vendor.ref(""); const loadingStyle = common_vendor.computed(() => { return `background-image: url(${loadingIconSvg.value});`; }); common_vendor.watch( () => props.loading, () => { buildLoadingSvg(); }, { deep: true, immediate: true } ); function handleClick(event) { if (!props.disabled && !props.loading) { emit("click", event.detail); } } function handleGetuserinfo(event) { emit("getuserinfo", event.detail); } function handleConcat(event) { emit("contact", event.detail); } function handleGetphonenumber(event) { emit("getphonenumber", event.detail); } function handleError(event) { emit("error", event.detail); } function handleLaunchapp(event) { emit("launchapp", event.detail); } function handleOpensetting(event) { emit("opensetting", event.detail); } function handleChooseavatar(event) { emit("chooseavatar", event.detail); } function handleAgreePrivacyAuthorization(event) { emit("agreeprivacyauthorization", event.detail); } function buildLoadingSvg() { const { loadingColor, type, plain } = props; let color = loadingColor; if (!color) { switch (type) { case "primary": color = "#4D80F0"; break; case "success": color = "#34d19d"; break; case "info": color = "#333"; break; case "warning": color = "#f0883a"; break; case "error": color = "#fa4350"; break; case "default": color = "#333"; break; } } const svg = loadingIcon(color, !plain); loadingIconSvg.value = `"data:image/svg+xml;base64,${common_vendor.encode(svg)}"`; } return (_ctx, _cache) => { return common_vendor.e({ a: _ctx.loading }, _ctx.loading ? { b: common_vendor.s(loadingStyle.value) } : _ctx.icon ? { d: common_vendor.p({ ["custom-class"]: "wd-button__icon", name: _ctx.icon }) } : {}, { c: _ctx.icon, e: `${_ctx.disabled || _ctx.loading ? "" : "wd-button--active"}`, f: common_vendor.s(_ctx.customStyle), g: common_vendor.n("is-" + _ctx.type), h: common_vendor.n("is-" + _ctx.size), i: common_vendor.n(_ctx.plain ? "is-plain" : ""), j: common_vendor.n(_ctx.disabled ? "is-disabled" : ""), k: common_vendor.n(_ctx.round ? "is-round" : ""), l: common_vendor.n(_ctx.hairline ? "is-hairline" : ""), m: common_vendor.n(_ctx.block ? "is-block" : ""), n: common_vendor.n(_ctx.loading ? "is-loading" : ""), o: common_vendor.n(_ctx.customClass), p: hoverStartTime.value, q: hoverStayTime.value, r: _ctx.openType, s: _ctx.sendMessageTitle, t: _ctx.sendMessagePath, v: _ctx.sendMessageImg, w: _ctx.appParameter, x: _ctx.showMessageCard, y: _ctx.sessionFrom, z: _ctx.lang, A: _ctx.hoverStopPropagation, B: _ctx.formType, C: common_vendor.o(handleClick), D: common_vendor.o(handleGetuserinfo), E: common_vendor.o(handleConcat), F: common_vendor.o(handleGetphonenumber), G: common_vendor.o(handleError), H: common_vendor.o(handleLaunchapp), I: common_vendor.o(handleOpensetting), J: common_vendor.o(handleChooseavatar), K: common_vendor.o(handleAgreePrivacyAuthorization) }); }; } })); const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-aa3a6253"]]); wx.createComponent(Component); //# sourceMappingURL=wd-button.js.map