请教:微信小程序(有随机数)页面不能重新加载(刷新)问题。

请教:微信小程序(有随机数)页面不能重新加载(刷新)问题。

小程序共3个页面,在页面间可任意跳转,
每页上方都想随机展示几幅图
且希望每次切换页面时图片随机不同
(采用了随机数)

在index.js中我写了:

Page({
  data: {
     imglist1: [
       '/pic/pic1/tt' + Math.ceil(Math.random() * 9) + '.jpg',
       '/pic/pic1/tt' + Math.ceil(Math.random() * 9) + '.jpg',
       '/pic/pic1/tt' + Math.ceil(Math.random() * 9) + '.jpg',
      // { url: '/pic/pic1/tt' + Math.ceil(Math.random() * 9) + '.jpg' },
    ],
  })

在index.wxml中我写了:

<swiper class="swipers1">
    <block wx:for="{{imglist1}}">
         <swiper-item>
             <image  class="imgstyle1"  mode="aspectFill"  src="{{item}}"></image>
        </swiper-item>
    </block>
</swiper>

目前症状:
初次进入小程序,图片变化了
但无论怎么切换页面,图片都不变
(随机数没被重新执行?)

使用了wx.switchTab,不起作用。
请高手指教。

感谢!
芝罘码农CHR

在page的onload事件中setData

使随机数重新执行,需要重新调整程序