在Vue3中使用vue-Aplayer报错 Uncaught TypeError: Cannot read property 'version' of undefined

在Vue3中使用vue-Aplayer报错 Uncaught TypeError: Cannot read property 'version' of undefined
报错如下

img

Uncaught TypeError: Cannot read property 'version' of undefined

这个错误是指 调用这个version属性的对象是 undefined
比如你的代码是 obj.version
就是指obj变量的值是 undefined,undefined不是对象,没法调用version属性
这种情况一般常见于数组下标越界的情况。
如你的代码是

for (var i = 0; i <= 6; i++)
    arr[i].version

比如arr数组下标只有0到5元素存放了有version属性的对象。
当i=6时下标越界, arr[i]的值就是 undefined

arr[i].version 也就成了 undefined.version