欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue中添加語(yǔ)音播報(bào)功能的實(shí)現(xiàn)

 更新時(shí)間:2022年04月20日 09:34:15   作者:北海冥魚(yú)未眠  
本文主要介紹了vue中添加語(yǔ)音播報(bào)功能的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

1:首先把我們的靜態(tài)資源文件加入到前端工程項(xiàng)目當(dāng)中

我這里mp3文件就是要播報(bào)的語(yǔ)言文件

在這里插入圖片描述

2: 頁(yè)面中加入標(biāo)簽

<!-- src 后面的鏈接是我保存在static文件下的一段報(bào)警聲 -->
<audio v-show="false" id="audioSuccessIn" src="/static/successIn.mp3"/> 
<audio v-show="false" id="audioFalseIn" src="/static/falseIn.mp3"/>
<audio v-show="false" id="audioSuccessOut" src="/static/successOut.mp3"/> 
<audio v-show="false" id="audioFalseOut" src="/static/falseOut.mp3"/> 

3: 在相應(yīng)的方法的后面調(diào)用我們的函數(shù)即可

在method里面對(duì)應(yīng)的方法里面進(jìn)行調(diào)用即可。

goodsDetailInOutSave(this.json)
            .then(res => {
              this.detailFormVisible = false
              this.loading = false
              if (res.success) {
                this.getdata(this.formInline)
                this.$message({
                  type: 'success',
                  message: '商品出入庫(kù)成功!'
                })
                if(this.inOrOut===1){
                    this.playaudio('audioSuccessIn')
                }else if(this.inOrOut===2){
                  this.playaudio('audioSuccessOut')
                }

                
              } else {
                this.$message({
                  type: 'info',
                  message: res.msg
                })
                if(this.inOrOut===1){
                    this.playaudio('audioFalseIn')
                }else if(this.inOrOut===2){
                  this.playaudio('audioFalseOut')
                }

                
              }
            })
            .catch(err => {
              // this.goodsNumEditVisible = false
              this.loading = false
              this.$message.error('商品出入庫(kù)失敗,請(qǐng)稍后再試!')
            })
    },

到此這篇關(guān)于vue中添加語(yǔ)音播報(bào)功能的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)vue 添加語(yǔ)音播報(bào)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論