no message

cyl/master-0822^2
jscyl13849007907 3 months ago
parent b0632e6210
commit e2a02d5cc4

@ -31,7 +31,7 @@
cusMessage: { cusMessage: {
handler(newVal) { handler(newVal) {
console.log('newVal',newVal) console.log('newVal',newVal)
const hasDot = newVal.endsWith('。'); const hasDot = String(newVal).endsWith('。');
const messageWithoutDot = hasDot ? newVal.slice(0, -1) : newVal; const messageWithoutDot = hasDot ? newVal.slice(0, -1) : newVal;
this.displayedMessage = messageWithoutDot; this.displayedMessage = messageWithoutDot;
if (this.isShow) { if (this.isShow) {
@ -45,9 +45,12 @@
'isRender': { 'isRender': {
handler(newVal) { handler(newVal) {
this.isShow = newVal; this.isShow = newVal;
const hasDot = this.cusMessage.endsWith('。'); if(this.cusMessage){
const messageWithoutDot = hasDot ? this.cusMessage.slice(0, -1) : this.cusMessage; let _str = String(this.cusMessage);
this.displayedMessage = this.isShow ? messageWithoutDot + '...' : (hasDot ? messageWithoutDot + '。' : messageWithoutDot); const hasDot = _str.endsWith('。');
const messageWithoutDot = hasDot ? _str.slice(0, -1) : _str;
this.displayedMessage = this.isShow ? messageWithoutDot + '...' : (hasDot ? messageWithoutDot + '。' : messageWithoutDot);
}
}, },
immediate: true immediate: true
} }

Loading…
Cancel
Save