b2nil / taro-ui-vue3

采用 Vue 3.0 重写的 Taro UI 组件库
https://b2nil.github.io/taro-ui-vue3/
MIT License
160 stars 51 forks source link

Toast Demo Warning: 元素 image 的 属性 src 的值数据量过大 #6

Closed b2nil closed 3 years ago

b2nil commented 4 years ago
VM4613:1 元素 image 的 属性 src 的值数据量过大,可能会影响渲染性能。考虑降低图片转为 base64 的阈值或在 CSS 中使用 base64。
daiyuanhao commented 3 years ago

这个有什么解决方法吗

b2nil commented 3 years ago

@daiyuanhao 实际上 Toast 中所用的三张图[loading, error, success](status 属性三个状态的展示图)已经转换为 base64 了,估计原图太大才出现了这个 Warning。 后面看看能不能换三张小点的图。

现在使用 AtToast 的话,可以给 image 属性直接传本地 image 或 图片访问地址, 或者使用 icon 属性, 不使用 status 属性即可:

<at-toast
   :icon="icon"    // icon 和 image 
   :image="image"  // 二选一即可
   :text="text"   
   // :status="status"   // 不使用就能避免出现上面的 warning
   :hasMask="hasMask"
   :isOpened="isOpened"
   :duration="duration"
   @close="handleClose"
/>