57 lines
1.8 KiB
JavaScript
57 lines
1.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
require("../../adapter-vue.js");
|
|
const TUIKit_utils_env = require("../../utils/env.js");
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
__name: "Icon",
|
|
props: {
|
|
file: { default: "" },
|
|
size: {},
|
|
width: { default: "20px" },
|
|
height: { default: "20px" },
|
|
hotAreaSize: {}
|
|
},
|
|
emits: ["onClick"],
|
|
setup(__props, { emit: __emit }) {
|
|
const emits = __emit;
|
|
const props = __props;
|
|
const iconHotAreaSize = common_vendor.computed(() => {
|
|
if (!props.hotAreaSize) {
|
|
return void 0;
|
|
}
|
|
if (isNaN(Number(props.hotAreaSize))) {
|
|
return String(props.hotAreaSize);
|
|
}
|
|
return `${props.hotAreaSize}px`;
|
|
});
|
|
const iconWidth = common_vendor.computed(() => {
|
|
return props.size ? props.size : props.width;
|
|
});
|
|
const iconHeight = common_vendor.computed(() => {
|
|
return props.size ? props.size : props.height;
|
|
});
|
|
const handleImgClick = (e) => {
|
|
emits("onClick", e);
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.unref(TUIKit_utils_env.isApp)
|
|
}, common_vendor.unref(TUIKit_utils_env.isApp) ? {
|
|
b: props.file,
|
|
c: common_vendor.unref(iconWidth),
|
|
d: common_vendor.unref(iconHeight)
|
|
} : {
|
|
e: props.file,
|
|
f: common_vendor.unref(iconWidth),
|
|
g: common_vendor.unref(iconHeight)
|
|
}, {
|
|
h: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "common-icon-container-mobile"),
|
|
i: common_vendor.unref(iconHotAreaSize),
|
|
j: common_vendor.o$1(handleImgClick)
|
|
});
|
|
};
|
|
}
|
|
});
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6d890098"]]);
|
|
wx.createComponent(Component);
|