Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

[Bad Smell] UserCard module 组件化拆分问题 #12

Open
ACERY1 opened this issue Mar 13, 2018 · 0 comments
Open

[Bad Smell] UserCard module 组件化拆分问题 #12

ACERY1 opened this issue Mar 13, 2018 · 0 comments
Labels
Shit Smell The Bad Smell Of Code

Comments

@ACERY1
Copy link
Member

ACERY1 commented Mar 13, 2018

问题描述:在设计组件的时候没有过多的去考虑不同用户身份带来的渲染组件不同,而是将所有的代码扁平化实现(即所有细节都在一个组件内部)在userCard,带来的弊端是有太多冗余的html代码以及css样式不好维护。

以后解决方式:一个组件仍然可以进行更细化的拆分,但是因为wepy不能导入全局scss,那么过多的进行组件化也会带来重复的scss代码。这一点就导致了我不想去做更多的组件化。为了代码美观而大量牺牲性能不太可取。

偏向于React的JSX语法,将一些html片段(比组件更细节的代码,可以理解为组件内部的子组件)封装到函数返回值内,然后通过render()进行调用,这样的方式很优雅。

@ACERY1 ACERY1 added the Shit Smell The Bad Smell Of Code label Mar 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Shit Smell The Bad Smell Of Code
Projects
None yet
Development

No branches or pull requests

1 participant