简体   繁体   English

删除消息,Framework7

[英]Remove message, Framework7

I can't seem to remove just one message using the JS framework, Framework7. 我似乎无法使用JS框架Framework7删除一条消息。 There is a "myMessages.removeMessage(message);" 有一个“ myMessages.removeMessage(message);”。 where message is "HTMLElement or string (with CSS Selector) of message element to remove.". 其中message是“ HTMLElement或要删除的消息元素的字符串(带有CSS选择器)”。 But I cant get this to work on just 1 message. 但是我无法让它仅处理一条消息。 Either all gets removed or none. 要么全部删除,要么全部删除。 Ive inspected the elements and they all seem to be the same (see screenshot). 我已经检查了元素,它们似乎都是相同的(请参见屏幕截图)。 Removing all can be done with eg 删除所有都可以用例如

    myMessages.removeMessage(".message-first");

Adding eg ".message-received" removes all received messages and so on. 添加例如“ .message-received”会删除所有接收到的消息,依此类推。 Cant find anything that separates between the very last message and all others. 无法找到在最后一条消息和所有其他消息之间有区别的任何内容。

Anyone that has any idea how to remove the last message (or a specific message) with Framework7? 有谁知道如何使用Framework7删除最后一条消息(或特定消息)的人?

在此处输入图片说明

使用Framework7( doc )中的Dom库,删除与".message-first"匹配的最后一个元素,只需执行$$.find() ,获取最后一项,然后使用.delete()删除它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM