-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app.show 是否支持传参,更新 props #626
Comments
感觉你可以考虑 let app;
let props = {
id: 1
};
const initSubApp = async (id) => {
app = await Garfish.loadApp('app2', {
entry: 'http://localhost:3001',
basename: '/test',
domGetter: '#container',
props,
});
app.mount();
}
const handleClick = (id) => {
if (!app) {
initSubApp(id);
return
}
props.id = id;
app.show();
}; |
好像不行. |
let app;
let id = 1;
let getId = ()=> id;
let props = {
getId
};
const initSubApp = async (id) => {
app = await Garfish.loadApp('app2', {
entry: 'http://localhost:3001',
basename: '/test',
domGetter: '#container',
props,
});
app.mount();
}
const handleClick = (id) => {
if (!app) {
initSubApp(id);
return
}
id = id;
app.show();
}; 你尝试通过一个函数去获取值,这个值维护在主应用上面,上面的方式确实不行,因为被 Garfish 初始化参数的时候拷贝了,函数是不会拷贝的,你把值变更后子应用通过函数可以获取到最新的值 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clear and concise description of the problem
每次点击都会更新参数,app.show 是否可以支持传参。
Suggested solution
app.show 支持传参
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: