路泰科技体检小程序UI设计新版本
1
wwl
5 天以前 a6cdbcfe28fcc40ebb4919f57d60fb20122e8e57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
 * @fileoverview audio 插件
 */
const context = require('./context')
let index = 0
 
function Audio (vm) {
  this.vm = vm
}
 
Audio.prototype.onUpdate = function () {
  this.audios = []
}
 
Audio.prototype.onParse = function (node) {
  if (node.name === 'audio') {
    if (!node.attrs.id) {
      node.attrs.id = 'a' + index++
    }
    this.audios.push(node.attrs.id)
  }
}
 
Audio.prototype.onLoad = function () {
  setTimeout(() => {
    for (let i = 0; i < this.audios.length; i++) {
      const ctx = context.get(this.audios[i])
      ctx.id = this.audios[i]
      this.vm._videos.push(ctx)
    }
  }, 500)
}
 
module.exports = Audio