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

【功能】希望 :class 能扩展语法与功能 #1893

Closed
Devil-Cong opened this issue Nov 4, 2018 · 5 comments
Closed

【功能】希望 :class 能扩展语法与功能 #1893

Devil-Cong opened this issue Nov 4, 2018 · 5 comments

Comments

@Devil-Cong
Copy link

有块功能,需要通过后端返回来的 type 来控制对应的不同的样式,现有的语法只能这样写,type 的枚举值比较多,写起来有点不够优雅

<view :class="{ 'animated': animated, 'ocean': type === 'ocean', 'sky': type === 'sky', 'flame': type === 'flame' }">

建议扩展成以下类似 Vue 那样的语法跟功能

<view :class="[ type, { 'animated': animated } ]">
@xiaomizhou66
Copy link
Contributor

请问怎么动态控制 class 呀,我想用三元表达式不知道怎么做。
想问下, :class 与 class 能并存么?

@dtboy1995
Copy link

@xiaomizhou66 举个例子
比如

<text class="{{option == 0? 'selected':'normal'}}">例子</text>

Gcaufy added a commit that referenced this issue Jun 15, 2019
BREAKING CHANGE: :class

re #1893
@Gcaufy
Copy link
Collaborator

Gcaufy commented Jun 15, 2019

@Devil-Cong 这种方式已经支持到了

@Gcaufy Gcaufy closed this as completed Jun 15, 2019
Gcaufy added a commit that referenced this issue Jun 16, 2019
@hsqoo
Copy link

hsqoo commented May 19, 2020

请问vue可以多个{'classA': isShow, 'classB': isLoading} 怎么在wepy1.7.x实现?

@Gcaufy
Copy link
Collaborator

Gcaufy commented May 19, 2020

@hsqoo 1.7 中应该无此实现。

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

5 participants