解决小程序引用服务器上图片缓存问题

2020-05-19  本文已影响0人  依然_8deb

1、页面上直接写脚本

<!-- 引入wxs脚本 -->
<wxs module="tools">
  var random=function(){
    return Math.random()
  }
  module.exports.random = random;
</wxs>

需要的地方加载以下代码

<image src="{{fileUrl}}/pic.png?v={{tools.random()}}"></image>

2、页面引入utils文件夹中的aa文件,需要用的地方再加载

<wxs src="../../utils/aa.wxs" module="tools" />
上一篇 下一篇

猜你喜欢

热点阅读