Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【WIP】chore(Cell): optimize borderless #2247

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions src/cell-group/cell-group.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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,
};
Expand All @@ -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 }));
},
};
}
1 change: 1 addition & 0 deletions src/cell/cell.less
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
right: @cell-border-right-space;
}

&:last-child::after,
&--borderless::after {
display: none;
}
Expand Down
9 changes: 1 addition & 8 deletions src/cell/cell.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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,
};
Expand All @@ -35,7 +29,6 @@ export default class Cell extends SuperComponent {
data = {
prefix,
classPrefix: name,
isLastChild: false,
};

onClick(e) {
Expand Down
2 changes: 1 addition & 1 deletion src/cell/cell.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<view
style="{{_._style([style, customStyle])}}"
class="class {{prefix}}-class {{classPrefix}} {{ !bordered || isLastChild ? classPrefix + '--borderless' : ''}} {{classPrefix}}--{{align}}"
class="class {{prefix}}-class {{classPrefix}} {{ !bordered ? classPrefix + '--borderless' : ''}} {{classPrefix}}--{{align}}"
hover-class="{{ hover ? classPrefix + '--hover' : ''}}"
hover-stay-time="70"
bind:tap="onClick"
Expand Down