TabBar.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. "use strict";
  2. const common_vendor = require("../common/vendor.js");
  3. const utils_file = require("../utils/file.js");
  4. const _sfc_main = {
  5. __name: "TabBar",
  6. props: {
  7. placeholder: { type: Boolean, default: false },
  8. // 是否显示占位
  9. fixed: { type: Boolean, default: true }
  10. // 是否定位
  11. },
  12. setup(__props) {
  13. const menus = [
  14. { title: "首页", link: "/pages/index/index", img: "img/tabbar/index1.png", imgon: "img/tabbar/index2.png" },
  15. { title: "扫码点餐", link: "/pages/numberOfDiners/index", img: "img/tabbar/qr2.png", imgon: "img/tabbar/qr.png" },
  16. { title: "我的", link: "/pages/personal/index", img: "img/tabbar/personal1.png", imgon: "img/tabbar/personal2.png" }
  17. ];
  18. const props = __props;
  19. const getTabBarWrapStyle = common_vendor.computed(() => ({
  20. position: props.fixed ? "fixed" : "relative"
  21. }));
  22. function go(url) {
  23. if (url === common_vendor.unref(getPath))
  24. return;
  25. common_vendor.index.reLaunch({ url });
  26. }
  27. const getPath = common_vendor.computed(() => {
  28. const pages = getCurrentPages();
  29. common_vendor.index.__f__("log", "at components/TabBar.vue:55", "/" + pages[pages.length - 1].route);
  30. return "/" + pages[pages.length - 1].route;
  31. });
  32. return (_ctx, _cache) => {
  33. return common_vendor.e({
  34. a: __props.placeholder && __props.fixed
  35. }, __props.placeholder && __props.fixed ? {} : {}, {
  36. b: getPath.value === menus[0].link
  37. }, getPath.value === menus[0].link ? {
  38. c: common_vendor.unref(utils_file.getFileUrl)(menus[0].img)
  39. } : {
  40. d: common_vendor.unref(utils_file.getFileUrl)(menus[0].imgon)
  41. }, {
  42. e: common_vendor.t(menus[0].title),
  43. f: getPath.value === menus[0].link ? 1 : "",
  44. g: common_vendor.o(($event) => go(menus[0].link)),
  45. h: common_vendor.unref(utils_file.getFileUrl)(menus[1].img),
  46. i: common_vendor.unref(utils_file.getFileUrl)(menus[1].imgon),
  47. j: common_vendor.o(($event) => go(menus[1].link)),
  48. k: getPath.value === menus[2].link
  49. }, getPath.value === menus[2].link ? {
  50. l: common_vendor.unref(utils_file.getFileUrl)(menus[2].img)
  51. } : {
  52. m: common_vendor.unref(utils_file.getFileUrl)(menus[2].imgon)
  53. }, {
  54. n: common_vendor.t(menus[2].title),
  55. o: getPath.value === menus[2].link ? 1 : "",
  56. p: common_vendor.o(($event) => go(menus[2].link)),
  57. q: common_vendor.s(getTabBarWrapStyle.value)
  58. });
  59. };
  60. }
  61. };
  62. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-89ca1f91"]]);
  63. wx.createComponent(Component);
  64. //# sourceMappingURL=../../.sourcemap/mp-weixin/components/TabBar.js.map