如何把卸载Page外面的方法获得的值setData

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

在Page外面写的方法,调用时获取到数据,如何写setData在wxml中展现出来?

2 回复
wma
wma1 楼6 年前

写外面有啥好处吗?总感觉。。不太好吧。。

let currentPage = “”

Page({

    onLoad:function(){

        currentPage = this

    }

})

heping
heping2 楼5 年前

let pages = getCurrentPages();

let currentPage = pages[pages.length-1];currentPage.setData();