File tree Expand file tree Collapse file tree 3 files changed +12
-16
lines changed Expand file tree Collapse file tree 3 files changed +12
-16
lines changed Original file line number Diff line number Diff line change 1
1
<script >
2
2
import MdComponent from ' core/MdComponent'
3
3
import ripple from ' core/mixins/ripple'
4
+ import MdRouterLinkProps from ' core/MdRouterLinkProps'
4
5
import MdButtonContent from ' ./MdButtonContent'
5
6
6
7
export default new MdComponent ({
15
16
type: String ,
16
17
default: ' button'
17
18
},
18
- disabled: Boolean
19
+ disabled: Boolean ,
20
+ to: null
19
21
},
20
22
render (createElement ) {
21
23
const buttonContent = createElement (' md-button-content' , {
48
50
if (this .href ) {
49
51
tag = ' a'
50
52
} else if (this .$router && this .to ) {
51
- buttonAttrs .props = this .$props
53
+ this .$options .props = MdRouterLinkProps (this , this .$options .props )
54
+
52
55
tag = ' router-link'
56
+ buttonAttrs .props = this .$props
57
+ delete buttonAttrs .props .type
58
+ delete buttonAttrs .attrs .type
59
+ delete buttonAttrs .props .href
60
+ delete buttonAttrs .attrs .href
53
61
}
54
62
55
63
return createElement (tag, buttonAttrs, [buttonContent])
Original file line number Diff line number Diff line change 1
- import MdRouterLinkProps from 'core/MdRouterLinkProps'
2
1
import MdButton from './MdButton'
3
2
4
3
export default Vue => {
5
- const props = new MdRouterLinkProps ( Vue )
6
-
7
- MdButton . props = {
8
- ...MdButton . props ,
9
- ...props
10
- }
11
-
12
4
Vue . component ( MdButton . name , MdButton )
13
5
}
Original file line number Diff line number Diff line change 1
- export default Vue => {
2
- let props = Vue . options . components [ 'router-link' ] . options . props
3
-
1
+ export default ( context , props ) => {
4
2
return {
5
3
...props ,
6
- to : {
7
- type : props . to . type
8
- }
4
+ ...context . $options . components [ 'router-link' ] . options . props
9
5
}
10
6
}
You can’t perform that action at this time.
0 commit comments