uni-icons.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. "use strict";
  2. const uni_modules_uniIcons_components_uniIcons_uniicons_file_vue = require("./uniicons_file_vue.js");
  3. const common_vendor = require("../../../../common/vendor.js");
  4. const getVal = (val) => {
  5. const reg = /^[0-9]*$/g;
  6. return typeof val === "number" || reg.test(val) ? val + "px" : val;
  7. };
  8. const _sfc_main = {
  9. name: "UniIcons",
  10. emits: ["click"],
  11. props: {
  12. type: {
  13. type: String,
  14. default: ""
  15. },
  16. color: {
  17. type: String,
  18. default: "#333333"
  19. },
  20. size: {
  21. type: [Number, String],
  22. default: 16
  23. },
  24. customPrefix: {
  25. type: String,
  26. default: ""
  27. },
  28. fontFamily: {
  29. type: String,
  30. default: ""
  31. }
  32. },
  33. data() {
  34. return {
  35. icons: uni_modules_uniIcons_components_uniIcons_uniicons_file_vue.fontData
  36. };
  37. },
  38. computed: {
  39. unicode() {
  40. let code = this.icons.find((v) => v.font_class === this.type);
  41. if (code) {
  42. return code.unicode;
  43. }
  44. return "";
  45. },
  46. iconSize() {
  47. return getVal(this.size);
  48. },
  49. styleObj() {
  50. if (this.fontFamily !== "") {
  51. return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`;
  52. }
  53. return `color: ${this.color}; font-size: ${this.iconSize};`;
  54. }
  55. },
  56. methods: {
  57. _onClick() {
  58. this.$emit("click");
  59. }
  60. }
  61. };
  62. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  63. return {
  64. a: common_vendor.s($options.styleObj),
  65. b: common_vendor.n("uniui-" + $props.type),
  66. c: common_vendor.n($props.customPrefix),
  67. d: common_vendor.n($props.customPrefix ? $props.type : ""),
  68. e: common_vendor.o((...args) => $options._onClick && $options._onClick(...args), "dd")
  69. };
  70. }
  71. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  72. wx.createComponent(Component);
  73. //# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-icons/components/uni-icons/uni-icons.js.map