12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- "use strict";
- var common_vendor = require("../common/vendor.js");
- const _sfc_main = {
- components: {},
- data() {
- return {
- cateId: 0,
- menuCurrent: 0
- };
- },
- props: {
- list: {
- type: Array,
- default: []
- },
- menu: {
- default: 4
- },
- imgW: {
- type: Number,
- default: 88
- }
- },
- computed: {
- carousel() {
- if (this.list) {
- let data = this.sortData(this.list, this.menu * 2);
- return data;
- }
- }
- },
- created() {
- },
- methods: {
- sortData(oArr, length) {
- let arr = [];
- let minArr = [];
- oArr.forEach((c) => {
- if (minArr.length === length) {
- minArr = [];
- }
- if (minArr.length === 0) {
- arr.push(minArr);
- }
- minArr.push(c);
- });
- return arr;
- },
- onSwiper(e) {
- this.menuCurrent = e.detail.current;
- },
- routerTo(item) {
- this.cateId = item.cateId;
- this.$emit("menuClick", item);
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: $options.carousel
- }, $options.carousel ? common_vendor.e({
- b: common_vendor.f($options.carousel, (itemList, index, i0) => {
- return {
- a: common_vendor.f(itemList, (item, k1, i1) => {
- return {
- a: item.imgUrl,
- b: common_vendor.t(item.cateName),
- c: common_vendor.n($data.cateId == item.cateId ? "tab-title active" : "tab-title"),
- d: item.cateId,
- e: common_vendor.o(($event) => $options.routerTo(item), item.cateId)
- };
- }),
- b: index
- };
- }),
- c: $props.imgW + "rpx",
- d: $props.imgW + "rpx",
- e: common_vendor.s($props.list.length <= $props.menu ? `height:200rpx` : `height:340rpx`),
- f: common_vendor.s($props.list.length <= $props.menu ? `height:160rpx` : `height:320rpx`),
- g: common_vendor.o((...args) => $options.onSwiper && $options.onSwiper(...args)),
- h: $options.carousel.length > 1
- }, $options.carousel.length > 1 ? {
- i: common_vendor.f($options.carousel.length, (dot, index, i0) => {
- return {
- a: common_vendor.n($data.menuCurrent === index ? "dot-active" : "dot"),
- b: index
- };
- })
- } : {}, {
- j: common_vendor.s($props.list.length <= $props.menu ? `height:160rpx` : `height:320rpx`)
- }) : {});
- }
- var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/components/Menu.vue"]]);
- wx.createComponent(Component);
|