jeawin-astro 3.0.30 → 3.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jeawin-astro",
3
- "version": "3.0.30",
3
+ "version": "3.0.32",
4
4
  "author": "chaegumi <chaegumi@qq.com>",
5
5
  "description": "",
6
6
  "license": "MIT",
@@ -57,12 +57,7 @@ const categories: any[] = get_children_categories(
57
57
  {
58
58
  categories.map((category: any) => (
59
59
  <Fragment>
60
- {get_children_categories(
61
- all_categories,
62
- channel_id,
63
- category.id,
64
- true
65
- ) ? (
60
+ {get_children_categories(all_categories, channel_id, category.id).length ? (
66
61
  <SidebarSub
67
62
  channel_id={channel_id}
68
63
  category={category}
@@ -35,11 +35,13 @@ if (current_category_ids.includes(category.id)) {
35
35
  aClass += " sm-selected";
36
36
  ulClass += " sm-show";
37
37
  }
38
+
39
+ const categories = get_children_categories(all_categories, channel_id, category.id);
38
40
  ---
39
41
 
40
42
  <Fragment>
41
43
  {
42
- get_children_categories(all_categories, channel_id, category.id, true) ? (
44
+ categories.length ? (
43
45
  <li class={`${liClass} ${is_sub ? "" : ""}`}>
44
46
  <a
45
47
  class={aClass}
@@ -52,7 +54,7 @@ if (current_category_ids.includes(category.id)) {
52
54
  </button>
53
55
 
54
56
  <ul class={ulClass}>
55
- {get_children_categories(all_categories, channel_id, category.id).map(
57
+ {categories.map(
56
58
  (child: any) => (
57
59
  <Astro.self
58
60
  channel_id={channel_id}
@@ -116,7 +116,7 @@ const menus = await jeawinapi.get_menu_tree({ menu_id: 1 });
116
116
  menus.map((menu: any) =>
117
117
  menu.children ? (
118
118
  <Fragment>
119
- {menu.style == "mega" ? (
119
+ {menu.style == "1" ? (
120
120
  <MegaMenu menu={menu} menu_root_link_id={menu_root_link_id}>
121
121
  <Fragment
122
122
  set:html={Astro.slots.render("megamenu", [menu])}
@@ -74,7 +74,7 @@ import "smartmenus/dist/css/smartmenus.min.css"
74
74
  menus.map((menu: any) =>
75
75
  menu.children ? (
76
76
  <Fragment>
77
- {menu.style == "mega" ? (
77
+ {menu.style == "1" ? (
78
78
  <MegaMenu menu={menu} menu_root_link_id={menu_root_link_id}>
79
79
  <Fragment
80
80
  set:html={Astro.slots.render("megamenu", [menu])}
@@ -29,7 +29,7 @@ export function img_change_attrs(img_html: any, add_attrs: any, remove_attrs: an
29
29
  /**
30
30
  * 返回子类别
31
31
  */
32
- export function get_children_categories(all_categories: any, channel_id: any, category_id: any, is_check?: boolean): any;
32
+ export function get_children_categories(all_categories: any, channel_id: any, category_id: any): any;
33
33
  /**
34
34
  * 截取html
35
35
  */
@@ -307,17 +307,11 @@ export function img_change_attrs(img_html, add_attrs, remove_attrs) {
307
307
  /**
308
308
  * 返回子类别
309
309
  */
310
- export function get_children_categories(all_categories, channel_id, category_id, is_check = false) {
310
+ export function get_children_categories(all_categories, channel_id, category_id) {
311
311
  const return1 = _.filter(all_categories, (o) => {
312
312
  return Number(o.channel_id) === Number(channel_id) && Number(o.parent_id) === Number(category_id);
313
313
  });
314
314
  // console.log(return1);
315
- if (is_check) {
316
- // 如果是用于判断,那如果是空数组要返回false
317
- if (return1.length == 0) {
318
- return false;
319
- }
320
- }
321
315
  return return1;
322
316
  }
323
317