import Vue from 'vue' ; import '@/scss/button.scss' ; export default Vue . extend ( { name : 'w-button' , props : { type : { type : String , default : 'default' , } , isLoading : Boolean , disabled : Boolean , mini : Boolean , plain : Boolean , } , computed : { classes ( ) { const ret = { 'weui-btn' : true , 'weui-btn_loading' : this . isLoading , 'weui-btn_mini' : this . mini , } ; const classType = this . plain ? `weui-btn_plain-${ this . type }` : `weui-btn_${ this . type }` ; const classDisabled = this . plain ? 'weui-btn_plain-disabled' : 'weui-btn_disabled' ; ret [ classType ] = true ; ret [ classDisabled ] = this . disabled ; return ret as object ; } , } , methods : { onClick ( event ) { this . $emit ( 'click' , event ) ; } , } , render ( ) { return ( < button class = { this . classes } onClick = { ( e ) => { this . onClick ( e ) ; } } disabled = { this . disabled } > { this . isLoading && < i class = "weui-loading" />} { this . $slots . default } < /button>); } , } ) ;