From a648d59d0e810cbe3f41384ae708702c3f362436 Mon Sep 17 00:00:00 2001 From: anlyyao Date: Fri, 4 Aug 2023 12:36:24 +0800 Subject: [PATCH] chore(Cell): optimize borderless --- src/cell-group/cell-group.ts | 18 +----------------- src/cell/cell.less | 1 + src/cell/cell.ts | 9 +-------- src/cell/cell.wxml | 2 +- 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/cell-group/cell-group.ts b/src/cell-group/cell-group.ts index 57f6a574b..e242e2251 100644 --- a/src/cell-group/cell-group.ts +++ b/src/cell-group/cell-group.ts @@ -1,4 +1,4 @@ -import { SuperComponent, wxComponent, RelationsOptions } from '../common/src/index'; +import { SuperComponent, wxComponent } from '../common/src/index'; import config from '../common/config'; import props from './props'; @@ -9,15 +9,6 @@ const name = `${prefix}-cell-group`; export default class CellGroup extends SuperComponent { externalClasses = [`${prefix}-class`, `${prefix}-class-title`]; - relations: RelationsOptions = { - '../cell/cell': { - type: 'child', - linked() { - this.updateLastChid(); - }, - }, - }; - options = { addGlobalClass: true, }; @@ -34,11 +25,4 @@ export default class CellGroup extends SuperComponent { prefix, classPrefix: name, }; - - methods = { - updateLastChid() { - const items = this.$children; - items.forEach((child, index) => child.setData({ isLastChild: index === items.length - 1 })); - }, - }; } diff --git a/src/cell/cell.less b/src/cell/cell.less index 6ace42b13..1d17cabf6 100644 --- a/src/cell/cell.less +++ b/src/cell/cell.less @@ -42,6 +42,7 @@ right: @cell-border-right-space; } + &:last-child::after, &--borderless::after { display: none; } diff --git a/src/cell/cell.ts b/src/cell/cell.ts index e1e2cd45e..173c867de 100644 --- a/src/cell/cell.ts +++ b/src/cell/cell.ts @@ -1,4 +1,4 @@ -import { SuperComponent, wxComponent, RelationsOptions } from '../common/src/index'; +import { SuperComponent, wxComponent } from '../common/src/index'; import config from '../common/config'; import props from './props'; @@ -20,12 +20,6 @@ export default class Cell extends SuperComponent { `${prefix}-class-right-icon`, ]; - relations: RelationsOptions = { - '../cell-group/cell-group': { - type: 'parent', - }, - }; - options = { multipleSlots: true, }; @@ -35,7 +29,6 @@ export default class Cell extends SuperComponent { data = { prefix, classPrefix: name, - isLastChild: false, }; onClick(e) { diff --git a/src/cell/cell.wxml b/src/cell/cell.wxml index e15486982..32cfe7be1 100644 --- a/src/cell/cell.wxml +++ b/src/cell/cell.wxml @@ -2,7 +2,7 @@