const { listNotices } = require('../../api/noticeApi') Page({ data: { loading: false, notices: [] }, onLoad() { this.load() }, load() { this.setData({ loading: true }) listNotices() .then((notices) => this.setData({ notices: notices || [] })) .catch((error) => wx.showToast({ title: error.message, icon: 'none' })) .finally(() => this.setData({ loading: false })) } })