增加消息类型:event
This commit is contained in:
@@ -521,6 +521,10 @@ export default {
|
||||
lastContentRender[messageType] = render;
|
||||
},
|
||||
lastContentRender(message) {
|
||||
if(!isFunction(lastContentRender[message.type])){
|
||||
console.error(`not found '${message.type}' of the latest message renderer,try to use ‘setLastContentRender()’`);
|
||||
return '';
|
||||
};
|
||||
return lastContentRender[message.type].call(this, message);
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -2,14 +2,20 @@
|
||||
export default {
|
||||
name: "lemonMessageEvent",
|
||||
inheritAttrs: false,
|
||||
inject: ["IMUI"],
|
||||
render() {
|
||||
const { content } = this.$attrs.message;
|
||||
return (
|
||||
<div class="lemon-message lemon-message-event">
|
||||
<span class="lemon-message-event__content">{content}</span>
|
||||
<span class="lemon-message-event__content" on-click={e => this._emitClick(e, "content")}>{content}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
_emitClick(e, key) {
|
||||
this.IMUI.$emit("message-click", e, key, this.$attrs.message,this.IMUI);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="stylus">
|
||||
|
||||
@@ -62,17 +62,24 @@ export default {
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
let attrs;
|
||||
if(message.type == 'event'){
|
||||
attrs = {message: message};
|
||||
}else{
|
||||
attrs = {
|
||||
timeFormat: this.timeFormat,
|
||||
message: message,
|
||||
reverse: this.reverseUserId == message.fromUser.id,
|
||||
hideTime:this.hideTime,
|
||||
hideName: this.hideName
|
||||
}
|
||||
}
|
||||
node.push(
|
||||
<tagName
|
||||
ref="message"
|
||||
refInFor={true}
|
||||
attrs={{
|
||||
timeFormat: this.timeFormat,
|
||||
message: message,
|
||||
reverse: this.reverseUserId == message.fromUser.id,
|
||||
hideTime:this.hideTime,
|
||||
hideName: this.hideName
|
||||
}}
|
||||
attrs={attrs}
|
||||
/>
|
||||
);
|
||||
return node;
|
||||
|
||||
@@ -7,5 +7,8 @@ export default {
|
||||
},
|
||||
text(message) {
|
||||
return this.replaceEmojiName(message.content);
|
||||
}
|
||||
},
|
||||
event(message){
|
||||
return '[通知]';
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user