su-toolbar.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const _sfc_main = {
  4. name: "SuToolbar",
  5. props: {
  6. // 是否展示工具条
  7. show: {
  8. type: Boolean,
  9. default: true
  10. },
  11. // 取消按钮的文字
  12. cancelText: {
  13. type: String,
  14. default: "取消"
  15. },
  16. // 确认按钮的文字
  17. confirmText: {
  18. type: String,
  19. default: "确认"
  20. },
  21. // 取消按钮的颜色
  22. cancelColor: {
  23. type: String,
  24. default: "#909193"
  25. },
  26. // 确认按钮的颜色
  27. confirmColor: {
  28. type: String,
  29. default: "#3c9cff"
  30. },
  31. // 标题文字
  32. title: {
  33. type: String,
  34. default: ""
  35. }
  36. },
  37. methods: {
  38. // 点击取消按钮
  39. cancel() {
  40. this.$emit("cancel");
  41. },
  42. // 点击确定按钮
  43. confirm() {
  44. this.$emit("confirm");
  45. },
  46. // 阻止事件冒泡
  47. preventEvent(e) {
  48. e && typeof e.stopPropagation === "function" && e.stopPropagation();
  49. },
  50. // 空操作
  51. noop(e) {
  52. this.preventEvent(e);
  53. }
  54. }
  55. };
  56. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  57. return common_vendor.e({
  58. a: $props.show
  59. }, $props.show ? common_vendor.e({
  60. b: common_vendor.t($props.cancelText),
  61. c: common_vendor.o((...args) => $options.cancel && $options.cancel(...args)),
  62. d: $props.cancelColor,
  63. e: $props.title
  64. }, $props.title ? {
  65. f: common_vendor.t($props.title)
  66. } : {}, {
  67. g: common_vendor.t($props.confirmText),
  68. h: common_vendor.o((...args) => $options.confirm && $options.confirm(...args)),
  69. i: $props.confirmColor,
  70. j: common_vendor.o((...args) => $options.noop && $options.noop(...args))
  71. }) : {});
  72. }
  73. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2c641e39"], ["__file", "D:/zx/mall-front-app/sheep/ui/su-toolbar/su-toolbar.vue"]]);
  74. wx.createComponent(Component);