[improvement] move custom-class to template (#976)

This commit is contained in:
neverland 2018-11-28 17:31:41 +08:00 committed by GitHub
parent 4fbc3434d6
commit 9f128a1fe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 14 additions and 11 deletions

View File

@ -27,7 +27,7 @@ VantComponent({
computed: {
classes(): string {
const { type, size, block, plain, round, square, loading, disabled } = this.data;
return this.classNames('custom-class', 'van-button', `van-button--${type}`, `van-button--${size}`, {
return this.classNames('van-button', `van-button--${type}`, `van-button--${size}`, {
'van-button--block': block,
'van-button--round': round,
'van-button--plain': plain,

View File

@ -1,7 +1,7 @@
<button
id="{{ id }}"
lang="{{ lang }}"
class="{{ classes }}"
class="custom-class {{ classes }}"
open-type="{{ openType }}"
session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}"

View File

@ -33,7 +33,7 @@ VantComponent({
computed: {
cellClass(): string {
const { data } = this;
return this.classNames('custom-class', 'van-cell', {
return this.classNames('van-cell', {
'van-cell--center': data.center,
'van-cell--required': data.required,
'van-cell--borderless': !data.border,

View File

@ -1,5 +1,5 @@
<view
class="{{ cellClass }}"
class="custom-class {{ cellClass }}"
style="{{ customStyle }}"
bind:tap="onClick"
>

View File

@ -18,7 +18,7 @@ VantComponent({
computed: {
classes(): string {
const { span, offset } = this.data;
return this.classNames('custom-class', 'van-col', {
return this.classNames('van-col', {
[`van-col--${span}`]: span,
[`van-col--offset-${offset}`]: offset
});

View File

@ -1,5 +1,5 @@
<view
class="{{ classes }}"
class="custom-class {{ classes }}"
style="{{ style }}"
>
<slot />

View File

@ -25,7 +25,7 @@ VantComponent({
computed: {
classes(): string {
return this.classNames('custom-class', 'van-switch', {
return this.classNames('van-switch', {
'van-switch--on': this.data.checked,
'van-switch--disabled': this.data.disabled
});

View File

@ -1,6 +1,6 @@
<view
style="{{ style }}"
class="{{ classes }}"
class="custom-class {{ classes }}"
bind:tap="onClick"
>
<view class="van-switch__node node-class">

View File

@ -136,7 +136,7 @@ Page({
| duration | 动画时间 (单位秒) | `Number` | `0.3` |
| line-width | 底部条宽度 (px) | `Number` | 与当前标签等宽 |
| swipe-threshold | 滚动阈值,设置标签数量超过多少个可滚动 | `Number` | `4` |
| animated | 是否使用动画切换 Tabs | `Boolean` | - |
| animated | 是否使用动画切换 Tabs | `Boolean` | `false` |
### Tab API

View File

@ -21,7 +21,7 @@ VantComponent({
computed: {
classes() {
const { data } = this;
return this.classNames('van-tag', 'custom-class', {
return this.classNames('van-tag', {
'van-tag--mark': data.mark,
'van-tag--plain': data.plain,
'van-tag--round': data.round,

View File

@ -1,3 +1,6 @@
<view class="{{ classes }}" style="{{ style }}">
<view
class="custom-class {{ classes }}"
style="{{ style }}"
>
<slot />
</view>