完成图片、文件兼容修改语音icon 回复头像显示
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<view class="voice-message" @click="playVoice">
|
||||
<image
|
||||
:src="isPlaying ? audioIcon : recordIcon"
|
||||
class="audio-icon flipped"
|
||||
:class="['audio-icon', { 'flipped': isSender }]"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="duration">{{ durationText }}</text>
|
||||
@@ -15,11 +15,15 @@ export default {
|
||||
source: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
isSender: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
durationText() {
|
||||
const d = this.source.soundElem && this.source.soundElem.duration;
|
||||
const d = this.source && this.source.soundElem && this.source.soundElem.duration;
|
||||
return d ? `${d}''` : '';
|
||||
}
|
||||
},
|
||||
@@ -46,7 +50,7 @@ export default {
|
||||
this.innerAudioContext = null;
|
||||
}
|
||||
this.innerAudioContext = uni.createInnerAudioContext();
|
||||
const rawUrl = this.source.soundElem && this.source.soundElem.sourceUrl || '';
|
||||
const rawUrl = this.source && this.source.soundElem && this.source.soundElem.sourceUrl || '';
|
||||
this.innerAudioContext.src = this.getFixedSourceUrl(rawUrl);
|
||||
this.isPlaying = true;
|
||||
this.innerAudioContext.play();
|
||||
|
||||
Reference in New Issue
Block a user