|
@@ -12,7 +12,7 @@
|
|
|
v-for="(item) in showDanmakuData"
|
|
|
:key="item"
|
|
|
>
|
|
|
- <span> {{ item }}</span>
|
|
|
+ <span v-html="item"></span>
|
|
|
</li>
|
|
|
</transition-group>
|
|
|
</div>
|
|
@@ -31,7 +31,7 @@
|
|
|
:src="closeIcon || ''"
|
|
|
v-if="!isShowList"
|
|
|
/>
|
|
|
- <button class="send-btn primary" @click="sendDanmakuSelf(danmu)">发送</button>
|
|
|
+ <button class="send-btn primary" @click="leaveMsg">发送</button>
|
|
|
</div>
|
|
|
<ul class="show-list" v-show="isShowSelectList">
|
|
|
<li
|
|
@@ -39,8 +39,8 @@
|
|
|
v-for="(item, key) in quotes"
|
|
|
:key="key"
|
|
|
@click="sendDanmaku(key)"
|
|
|
+ v-html="item"
|
|
|
>
|
|
|
- {{ item }}
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
@@ -76,6 +76,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { saveBarrage } from "@/config/api";
|
|
|
+
|
|
|
+
|
|
|
export default {
|
|
|
name: "danmaku",
|
|
|
props: {
|
|
@@ -86,6 +89,13 @@ export default {
|
|
|
];
|
|
|
},
|
|
|
},
|
|
|
+ danmuArr: {
|
|
|
+ type: Array,
|
|
|
+ default: function() {
|
|
|
+ return [
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ },
|
|
|
showIcon: {
|
|
|
type: String,
|
|
|
required: true,
|
|
@@ -146,12 +156,25 @@ export default {
|
|
|
this.isNotInputAction = true;
|
|
|
this.danmu=''
|
|
|
},
|
|
|
+ async leaveMsg(){
|
|
|
+ let tmp = this.danmu.trim()
|
|
|
+ if (!tmp) {
|
|
|
+ return alert('弹幕不能为空')
|
|
|
+ }
|
|
|
+ saveBarrage({
|
|
|
+ content: tmp,
|
|
|
+ },res=>{
|
|
|
+ if (res.code==0) {
|
|
|
+ this.sendDanmakuSelf(tmp)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
autoPopAnimation() {
|
|
|
if (!this.isNotInputAction) {
|
|
|
this.timer = setInterval(() => {
|
|
|
- if (this.autoIndex <= this.quotes.length) {
|
|
|
- if (this.quotes[this.autoIndex]) {
|
|
|
- this.showDanmakuData.push(this.quotes[this.autoIndex]);
|
|
|
+ if (this.autoIndex <= this.danmuArr.length) {
|
|
|
+ if (this.danmuArr[this.autoIndex]) {
|
|
|
+ this.showDanmakuData.push(this.danmuArr[this.autoIndex]);
|
|
|
this.autoIndex++;
|
|
|
} else {
|
|
|
clearInterval(this.timer);
|