改过这个文件的同学,按个手印
xeon
kevin
梁琪君
白赏文
再试一次
new Vue({ el: '#player', data() { return { vodPlayerJs: 'https://player.polyv.net/script/player.js', vid:'88083abbf593941c95d94d6ea7f419c7_8', vid2:'88083abbf58fbcb4af30338bc97696c1_8', vid3:'88083abbf593941c95d94d6ea7f419c7_8', }; }, mounted(){ this.loadPlayerScript(this.loadPlayer); }, methods: { loadPlayerScript(callback) { if (!window.polyvPlayer) { const myScript = document.createElement('script'); myScript.setAttribute('src', this.vodPlayerJs); myScript.onload = callback; document.body.appendChild(myScript); } else { callback(); } }, loadPlayer() { const polyvPlayer = window.polyvPlayer; this.player = polyvPlayer({ wrap: '#player', vid: this.vid , autoplay:false }); this.player2 = polyvPlayer({ wrap: '#player2', vid: this.vid2 , autoplay:false }); this.player3 = polyvPlayer({ wrap: '#player3', vid: this.vid3 , autoplay:false }); } }, destroyed() { if (this.player) { this.player.destroy(); this.player2.destroy(); this.player3.destroy(); } } })new Vue({ el: '#player2', data() { return { vodPlayerJs: 'https://player.polyv.net/script/player.js', vid2:'88083abbf593941c95d94d6ea7f419c7_8', }; }, mounted(){ this.loadPlayerScript(this.loadPlayer); }, methods: { loadPlayerScript(callback) { if (!window.polyvPlayer) { const myScript = document.createElement('script'); myScript.setAttribute('src', this.vodPlayerJs); myScript.onload = callback; document.body.appendChild(myScript); } else { callback(); } }, loadPlayer() { const polyvPlayer = window.polyvPlayer; this.player2 = polyvPlayer({ wrap: '#player2', vid: this.vid2, autoplay:false }); } }, destroyed() { if (this.player2) { this.player2.destroy(); } } })
Last updated