下一级界面,需要上一级界面刷新数据接口的时候:
uni.$emit('hly_class_homework_back_update', '作业返回刷新数据')
上一级界面,onLoad中执行:
import { onLoad, onReady, onUnload } from "@dcloudio/uni-app"
onLoad((option) => {
uni.$on('hly_class_homework_back_update', (schoolClassId) => {
downRefresh()
})
})
onUnload(() => {
uni.$off( 'hly_class_homework_back_update')
})
或者上一个界面在onShow里执行数据刷新操作