这是报错信息### 问题描述
Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "name"
查了一下大概说是props使用错误,但是没看懂是为啥,说是不允许双向数据绑定造成额
问题出现的环境背景及自己尝试过哪些方法
用的nuxt.js
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
<div v-if="item.videoUrl" class="video-panel">
<span class="title">{{ $t('companies-index.video') }}</span>
<div class="video">
<div @click="playpause">
<div><van-icon ref="videoIcon" name="play" size="1rem" color="white" /></div>
<!-- <img src="~/assets/img/vr_start.png" alt="" /> -->
</div>
<video ref="video" :src="$cdn(item.videoUrl)" :poster="poster">
{{ $t('companies-index.video-error') }}
</video>
</div>
</div>
//视频播放按钮
playpause() {
let myVideo = this.$refs.video
if (myVideo.paused) {
myVideo.play()
this.$refs.videoIcon.name = null
} else {
myVideo.pause()
this.$refs.videoIcon.name = 'pause'
}
}
你期待的结果是什么?实际看到的错误信息又是什么?
功能能正常实现,不知道为啥报错 以及解决报错
# 2个方法
第一个 :
第二个 :
这2个方法 ,
:before-close
是关键 ;