Skip to content

Commit

Permalink
feat(message): use setMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
novlan1 committed Aug 9, 2024
1 parent 32e0cf2 commit d8c9c26
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions src/message/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const SHOW_DURATION = 400;
const { prefix } = config;
const name = `${prefix}-message`;

let idIndex = 0;
@wxComponent()
export default class Message extends SuperComponent {
options: ComponentsOptionsType = {
Expand All @@ -35,41 +34,8 @@ export default class Message extends SuperComponent {

observers = {
visible(value) {
const id = `t-message-component-${idIndex}`;

if (value) {
this.setData(
{
messageList: [
{
id,
},
],
},
() => {
const instance = this.selectComponent(`#${id}`);
const { content, align, theme, icon, closeBtn, action, marquee, offset, duration, zIndex, gap, single } =
this.properties;

instance.setData(
{
content,
align,
theme,
icon,
closeBtn,
action,
marquee,
offset,
duration,
zIndex,
gap,
single,
},
instance.show.bind(instance, 0),
);
},
);
this.setMessage(this.properties, this.properties.theme);
} else {
this.setData({
messageList: [],
Expand All @@ -96,7 +62,6 @@ export default class Message extends SuperComponent {
...this.properties,
...this.data,
};
idIndex += 1;
}

/**
Expand Down

0 comments on commit d8c9c26

Please sign in to comment.