1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-06 03:57:59 +08:00
neverland ffa3fddfae
[bugfix] remove unnecessary props ()
* fix: Tabbar icon line-height

* [new feature] progress add showPivot prop

* [new feature] TabItem support vue-router

* [new feature] update document header style

* [Doc] add toast english ducoment

* [bugfix] Search box-sizing wrong

* [Doc] update vant-demo respo

* [Doc] translate theme & demo pages

* [Doc] add Internationalization document

* [bugfix] remove unnecessary props
2017-11-16 03:12:13 -06:00

72 lines
1.4 KiB
JavaScript

import Loading from '../loading';
export default {
name: 'van-button',
components: {
[Loading.name]: Loading
},
props: {
block: Boolean,
loading: Boolean,
disabled: Boolean,
nativeType: String,
bottomAction: Boolean,
tag: {
type: String,
default: 'button'
},
type: {
type: String,
default: 'default'
},
size: {
type: String,
default: 'normal'
}
},
methods: {
onClick(event) {
if (!this.loading && !this.disabled) {
this.$emit('click', event);
}
}
},
render(h) {
const { type, loading, disabled, tag: Tag } = this;
return (
<Tag
type={this.nativeType}
disabled={disabled}
class={[
'van-button',
'van-button--' + type,
'van-button--' + this.size,
{
'van-button--disabled': disabled,
'van-button--loading': loading,
'van-button--block': this.block,
'van-button--bottom-action': this.bottomAction
}
]}
onClick={this.onClick}
>
{loading
? <van-loading
class="van-button__icon-loading"
type="circle"
color={type === 'default' ? 'black' : 'white'}
/>
: null}
<span class="van-button__text">
{this.$slots.default}
</span>
</Tag>
);
}
};