[improvement] GoodsAction: jsx (#2513)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { use } from '../utils';
|
||||
import Button from '../button';
|
||||
import RouterLink from '../mixins/router-link';
|
||||
|
||||
const [sfc, bem] = use('goods-action-big-btn');
|
||||
|
||||
export default sfc({
|
||||
mixins: [RouterLink],
|
||||
|
||||
props: {
|
||||
text: String,
|
||||
primary: Boolean,
|
||||
loading: Boolean,
|
||||
disabled: Boolean
|
||||
},
|
||||
|
||||
methods: {
|
||||
onClick(event) {
|
||||
this.$emit('click', event);
|
||||
this.routerLink();
|
||||
}
|
||||
},
|
||||
|
||||
render(h) {
|
||||
return (
|
||||
<Button
|
||||
square
|
||||
class={bem()}
|
||||
size="large"
|
||||
loading={this.loading}
|
||||
disabled={this.disabled}
|
||||
type={this.primary ? 'danger' : 'warning'}
|
||||
onClick={this.onClick}
|
||||
>
|
||||
{this.$slots.default || this.text}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -1,43 +0,0 @@
|
||||
<template>
|
||||
<van-button
|
||||
square
|
||||
:class="b()"
|
||||
size="large"
|
||||
:loading="loading"
|
||||
:disabled="disabled"
|
||||
:type="primary ? 'danger' : 'warning'"
|
||||
@click="onClick"
|
||||
>
|
||||
<slot>{{ text }}</slot>
|
||||
</van-button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import create from '../utils/create';
|
||||
import VanButton from '../button';
|
||||
import RouterLink from '../mixins/router-link';
|
||||
|
||||
export default create({
|
||||
name: 'goods-action-big-btn',
|
||||
|
||||
mixins: [RouterLink],
|
||||
|
||||
components: {
|
||||
VanButton
|
||||
},
|
||||
|
||||
props: {
|
||||
text: String,
|
||||
primary: Boolean,
|
||||
loading: Boolean,
|
||||
disabled: Boolean
|
||||
},
|
||||
|
||||
methods: {
|
||||
onClick(event) {
|
||||
this.$emit('click', event);
|
||||
this.routerLink();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user