first commit
This commit is contained in:
112
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/icon.js
vendored
Normal file
112
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/icon.js
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
const uni_modules_tdesignUniapp_components_common_src_instantiationDecorator = require("../common/src/instantiationDecorator.js");
|
||||
const uni_modules_tdesignUniapp_components_common_config = require("../common/config.js");
|
||||
const uni_modules_tdesignUniapp_components_icon_props = require("./props.js");
|
||||
const uni_modules_tdesignUniapp_components_common_utils = require("../common/utils.js");
|
||||
const uni_modules_tdesignUniapp_components_common_utils_wxs = require("../common/utils.wxs.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const name = `${uni_modules_tdesignUniapp_components_common_config.prefix}-icon`;
|
||||
const _sfc_main = uni_modules_tdesignUniapp_components_common_src_instantiationDecorator.uniComponent({
|
||||
name,
|
||||
options: {
|
||||
styleIsolation: "shared"
|
||||
},
|
||||
externalClasses: [`${uni_modules_tdesignUniapp_components_common_config.prefix}-class`],
|
||||
props: {
|
||||
...uni_modules_tdesignUniapp_components_icon_props.props
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
componentPrefix: uni_modules_tdesignUniapp_components_common_config.prefix,
|
||||
classPrefix: name,
|
||||
isImage: false,
|
||||
iconStyle: void 0,
|
||||
tools: uni_modules_tdesignUniapp_components_common_utils_wxs.tools
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
name: {
|
||||
handler() {
|
||||
this.setIconStyle();
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
color: {
|
||||
handler() {
|
||||
this.setIconStyle();
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
size: {
|
||||
handler() {
|
||||
this.setIconStyle();
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
style: {
|
||||
handler() {
|
||||
this.setIconStyle();
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onTap(t) {
|
||||
this.$emit("click", t);
|
||||
},
|
||||
setIconStyle() {
|
||||
const {
|
||||
name: name2,
|
||||
color,
|
||||
size,
|
||||
classPrefix
|
||||
} = this;
|
||||
const isImage = name2.indexOf("/") !== -1;
|
||||
const sizeValue = uni_modules_tdesignUniapp_components_common_utils.addUnit(size);
|
||||
const colorStyle = color ? {
|
||||
color
|
||||
} : {};
|
||||
const fontStyle = size ? {
|
||||
"font-size": sizeValue
|
||||
} : {};
|
||||
const iconStyle = { ...colorStyle, ...fontStyle };
|
||||
this.isImage = isImage;
|
||||
if (isImage) {
|
||||
let iconSize = sizeValue;
|
||||
if (!iconSize) {
|
||||
uni_modules_tdesignUniapp_components_common_utils.getRect(this, `.${classPrefix}`).then((res) => {
|
||||
iconSize = uni_modules_tdesignUniapp_components_common_utils.addUnit(res == null ? void 0 : res.height);
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
iconStyle.width = iconSize;
|
||||
iconStyle.height = iconSize;
|
||||
}
|
||||
this.iconStyle = `${uni_modules_tdesignUniapp_components_common_utils.styles(iconStyle)}`;
|
||||
}
|
||||
}
|
||||
});
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.isImage
|
||||
}, _ctx.isImage ? {
|
||||
b: _ctx.name,
|
||||
c: common_vendor.n(_ctx.classPrefix + "__image"),
|
||||
d: common_vendor.n(_ctx.classPrefix + "--image")
|
||||
} : {}, {
|
||||
e: _ctx.tools.isValidIconName(_ctx.name) && !_ctx.isImage
|
||||
}, _ctx.tools.isValidIconName(_ctx.name) && !_ctx.isImage ? {
|
||||
f: common_vendor.n((_ctx.prefix ? _ctx.prefix : _ctx.classPrefix) + "-" + _ctx.name + " " + _ctx.classPrefix + "-base")
|
||||
} : {}, {
|
||||
g: common_vendor.n(_ctx.tClass),
|
||||
h: common_vendor.n(_ctx.prefix || "t-icon"),
|
||||
i: common_vendor.s(_ctx.tools._style([_ctx.iconStyle, _ctx.customStyle])),
|
||||
j: _ctx.ariaHidden,
|
||||
k: _ctx.ariaLabel,
|
||||
l: _ctx.ariaRole,
|
||||
m: common_vendor.o((...args) => _ctx.onTap && _ctx.onTap(...args))
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2e2ca7b4"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/icon/icon.js.map
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/icon.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/icon.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/icon.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/icon.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{['data-v-2e2ca7b4', g, h]}}" style="{{i}}" aria-hidden="{{j}}" aria-label="{{k}}" aria-role="{{l}}" bindtap="{{m}}"><view wx:if="{{a}}" class="{{['data-v-2e2ca7b4', d]}}"><image src="{{b}}" mode="aspectFit" class="{{['data-v-2e2ca7b4', c]}}"/></view><view wx:if="{{e}}" class="{{['data-v-2e2ca7b4', f]}}"/></view>
|
||||
7073
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/icon.wxss
vendored
Normal file
7073
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/icon.wxss
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/props.js
vendored
Normal file
31
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/icon/props.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
const props = {
|
||||
/** 图标颜色 */
|
||||
color: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
/** 图标名称或图片链接 */
|
||||
name: {
|
||||
type: String,
|
||||
default: "",
|
||||
required: true
|
||||
},
|
||||
/** 自定义图标前缀 */
|
||||
prefix: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
/** 图标大小, 如 `20`, `20px`, `48rpx`, 默认单位是 `px` */
|
||||
size: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
/** 点击图标时触发 */
|
||||
onClick: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/icon/props.js.map
|
||||
Reference in New Issue
Block a user