Skip to content

Commit d6cbbdd

Browse files
authored
Update button.js
1 parent 428d515 commit d6cbbdd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/button/button.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { mergeData } from 'vue-functional-data-merge'
2+
import { getConfigComponent } from '../../utils/config'
23
import pluckProps from '../../utils/pluck-props'
34
import { concat } from '../../utils/array'
45
import { keys } from '../../utils/object'
56
import { addClass, removeClass } from '../../utils/dom'
67
import BLink, { propsFactory as linkPropsFactory } from '../link/link'
78

9+
const NAME = 'BButton'
10+
811
const btnProps = {
912
block: {
1013
type: Boolean,
@@ -20,7 +23,7 @@ const btnProps = {
2023
},
2124
variant: {
2225
type: String,
23-
default: null
26+
default: getConfigComponent(NAME, 'variant')
2427
},
2528
type: {
2629
type: String,
@@ -85,7 +88,7 @@ function isNonStandardTag(props) {
8588
// Compute required classes (non static classes)
8689
function computeClass(props) {
8790
return [
88-
props.variant ? `btn-${props.variant}` : `btn-secondary`,
91+
`btn-${props.variant || getConfigComponent(NAME, 'variant')}`,
8992
{
9093
[`btn-${props.size}`]: Boolean(props.size),
9194
'btn-block': props.block,
@@ -136,7 +139,7 @@ function computeAttrs(props, data) {
136139

137140
// @vue/component
138141
export default {
139-
name: 'BButton',
142+
name: NAME,
140143
functional: true,
141144
props,
142145
render(h, { props, data, listeners, children }) {

0 commit comments

Comments
 (0)