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

[feature] Taro.Component 实例暴露一个属性以判断这是一个组件还是页面 #1166

Closed
fjc0k opened this issue Nov 18, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@fjc0k
Copy link
Contributor

fjc0k commented Nov 18, 2018

API

类似这样 this.$isPage,并将之加入 TypeScript 类型定义。

应用场景

创建项目级别的基本组件,供公共组件及页面继承扩展,如此可在基本组件里判断是否是页面,并注入相关业务逻辑,譬如登录状态、数据埋点之类。

补充

以上的应用场景在我看来更好的应该是分成基本组件和基本页面两个类,分别去继承,不过,加上 $isPage 可能对其他一些应用场景会更有意义。😀

@luckyadam luckyadam added the enhancement New feature or request label Nov 18, 2018
@Chen-jj
Copy link
Contributor

Chen-jj commented Nov 22, 2018

文档地址

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants