Page外的function如何调用setData()

发布于 7 年前作者 fujing4195 次浏览最后编辑 7 年前来自 ask

const app = getApp()

Page({

     bottomModal()

    })

function bottomModal() {

    this.setData({ modalName: ‘bottomModal’

})

请教各位大神,我在Page外自定义function,怎么才能通过setData设置数据呢?

2 回复
xiuying88
xiuying881 楼6 年前

this 传进来试试

ayao
ayao2 楼5 年前

获取页面实例