WeChat Mini Programs, how to call this.setData? in other js files

util.js
export let add = () = > {

this.setData({
    index: 123
})

}

Mar.07,2021

you can change the this direction with things like apply, and add uses ordinary functions.

export let add = function () {.}

const util=require ('.');

util.add.apply (this)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35802-2bf7f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35802-2bf7f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?