Skip to content
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

[RFC]MPA 场景下各个页面的统一逻辑应该如何维护 #678

Open
imsobear opened this issue Mar 24, 2021 · 0 comments
Open

[RFC]MPA 场景下各个页面的统一逻辑应该如何维护 #678

imsobear opened this issue Mar 24, 2021 · 0 comments

Comments

@imsobear
Copy link
Contributor

框架需要给出最佳实践或者方案,两种情况:

1. 页面级 setupAppear 之类的逻辑

一个简单的做法是封装一个 utils/pageSetup.js,每个页面自己调用下:

// src/pages/Home/index.js
import setupPage from '@/utils/setupPage';

setupPage('home', { //...options });

export default function() {
  return <>Home</>;
}

但感觉不是一个优雅的方案。

2. 组件声明周期的定制

比如权限、埋点、监控打点等,理论上用 hooks 就可以,但是我们现在缺少这方面的规范。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant