美文网首页
解决小程序引用服务器上图片缓存问题

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

作者: 依然_8deb | 来源:发表于2020-05-19 15:28 被阅读0次

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" />

相关文章

网友评论

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

      本文链接:https://www.haomeiwen.com/subject/disbohtx.html