@@ -2,25 +2,40 @@ import { render } from 'github-buttons'
22
33export default {
44 name : 'github-button' ,
5- props : [ 'href' , 'title ' , 'ariaLabel ' , 'dataIcon' , 'dataSize' , 'dataText ' , 'dataShowCount ' ] ,
5+ props : [ 'href' , 'ariaLabel ' , 'title ' , 'dataIcon' , 'dataSize' , 'dataShowCount ' , 'dataText ' ] ,
66 render : function ( h ) {
77 return h ( 'a' , { attrs : {
8- href : this . href ,
9- title : this . title ,
8+ 'href' : this . href ,
109 'aria-label' : this . ariaLabel ,
10+ 'title' : this . title ,
1111 'data-icon' : this . dataIcon ,
1212 'data-size' : this . dataSize ,
13- 'data-text ' : this . dataText ,
14- 'data-show-count ' : this . dataShowCount
13+ 'data-show-count ' : this . dataShowCount ,
14+ 'data-text ' : this . dataText
1515 } } , this . $slots . default )
1616 } ,
1717 mounted : function ( ) {
18- render ( this . $el . parentNode . insertBefore ( this . _ = document . createElement ( 'span' ) , this . $el ) . appendChild ( this . $el ) )
18+ this . render ( )
1919 } ,
2020 beforeUpdate : function ( ) {
21- this . _ . parentNode . replaceChild ( this . $el , this . _ )
21+ this . reset ( )
2222 } ,
2323 updated : function ( ) {
24- render ( this . $el . parentNode . insertBefore ( this . _ = document . createElement ( 'span' ) , this . $el ) . appendChild ( this . $el ) )
24+ this . render ( )
25+ } ,
26+ beforeDestroy : function ( ) {
27+ this . reset ( )
28+ } ,
29+ methods : {
30+ render : function ( ) {
31+ render ( this . $el . parentNode . insertBefore ( this . _ = document . createElement ( 'span' ) , this . $el ) . appendChild ( this . $el ) , ( function ( _this ) {
32+ return function ( el ) {
33+ _this . $el . parentNode . replaceChild ( el , _this . $el )
34+ }
35+ } ) ( this ) )
36+ } ,
37+ reset : function ( ) {
38+ this . _ . parentNode . replaceChild ( this . $el , this . _ )
39+ }
2540 }
2641}
0 commit comments