diff --git a/packages/cell/index.js b/packages/cell/index.js index cc64b09f3..51d94b722 100644 --- a/packages/cell/index.js +++ b/packages/cell/index.js @@ -1,7 +1,7 @@ import { use, isDef } from '../utils'; import { cellProps } from './shared'; import { emit, inherit, unifySlots } from '../utils/functional'; -import { routeProps, functionalRoute } from '../mixins/router-link'; +import { routeProps, functionalRoute } from '../mixins/router'; import Icon from '../icon'; const [sfc, bem] = use('cell'); diff --git a/packages/goods-action-big-btn/index.js b/packages/goods-action-big-btn/index.js index 75601ee4f..231ee34f5 100644 --- a/packages/goods-action-big-btn/index.js +++ b/packages/goods-action-big-btn/index.js @@ -1,10 +1,13 @@ import { use } from '../utils'; import Button from '../button'; -import { route, routeProps } from '../mixins/router-link'; +import { emit, inherit, unifySlots } from '../utils/functional'; +import { functionalRoute, routeProps } from '../mixins/router'; const [sfc, bem] = use('goods-action-big-btn'); export default sfc({ + functional: true, + props: { ...routeProps, text: String, @@ -13,25 +16,27 @@ export default sfc({ disabled: Boolean }, - methods: { - onClick(event) { - this.$emit('click', event); - route(this.$router, this); - } - }, + render(h, context) { + const { props } = context; + const slots = unifySlots(context); + + const onClick = event => { + emit(context, 'click', event); + functionalRoute(context); + }; - render(h) { return ( ); } diff --git a/packages/goods-action-mini-btn/index.js b/packages/goods-action-mini-btn/index.js index 90585f655..2c2a2887a 100644 --- a/packages/goods-action-mini-btn/index.js +++ b/packages/goods-action-mini-btn/index.js @@ -1,30 +1,42 @@ import { use } from '../utils'; import Icon from '../icon'; -import { route, routeProps } from '../mixins/router-link'; +import { emit, inherit, unifySlots } from '../utils/functional'; +import { functionalRoute, routeProps } from '../mixins/router'; const [sfc, bem] = use('goods-action-mini-btn'); export default sfc({ + functional: true, + props: { ...routeProps, text: String, - info: [String, Number], icon: String, + info: [String, Number], iconClass: String }, - methods: { - onClick(event) { - this.$emit('click', event); - route(this.$router, this); - } - }, + render(h, context) { + const { props } = context; + const slots = unifySlots(context); + + const onClick = event => { + emit(context, 'click', event); + functionalRoute(context); + }; - render(h) { return ( -