【发布时间】:2019-03-14 07:10:36
【问题描述】:
我想知道如何管理框架状态组件中的资产
以列表为例
<a-entity bind-for="for: shoppingItem; in: shoppingList; key: name">
<template>
<a-entity bind__text="value: shoppingItem.name"
data-amount="{{ shoppingItem.amount }}"></a-entity>
</template>
</a-entity>
我假设你会使用这样的东西
<a-assets bind-for="for: asset; in: assets; key: id">
<template>
<a-asset-item response-type="arraybuffer" bind__src="asset.src" bind__id="value: asset.id" />
</template>
</a-assets>
但这仅适用于视频。
如果我这样设置我的初始状态
initialState: {
hotspots: [],
assets: [{src: 'https://example.com/assets/logo.png' , id: 'logo'}]
},
并计划使用每个资产的 src 和 id 填充这些资产数组,然后 SRC 不会将其发送到出现错误的实体:
无法读取 null 的属性“匹配” 在 FileLoader.load (aframe-master.js:28912) 在 HTMLElement.value (aframe-master.js:57743) 在 HTMLElement.wrappedMethod (aframe-master.js:59621)
我试过<a-asset-item response-type="arraybuffer" src="{{asset.id}}" bind__src="value: asset.src" bind__id="value: asset.id" />
这也不起作用。
【问题讨论】:
标签: aframe