更新时间:2022-12-27 15:15:24
我通常创建一个包含以下内容的global.js:
I usually create a global.js containing:
module.exports = {
screen1: null,
};
并在屏幕上获取状态值
import GLOBAL from './global.js'
constructor() {
GLOBAL.screen1 = this;
}
现在您可以在任何地方使用它了,
Now you can use it anywhere like so:
GLOBAL.screen1.setState({
var: value
});