7070/* 0 */
7171/***/ ( function ( module , exports ) {
7272
73- const data = {
74- icons : [
75- 'square' ,
76- 'circle' ,
77- 'rectangle-vertical' ,
78- 'rectangle-horizontal'
79- ]
73+ var data = {
74+ icons : [ 'square' , 'circle' , 'rectangle-vertical' , 'rectangle-horizontal' ]
8075} ;
8176
8277Vue . component ( 'icon' , {
@@ -91,26 +86,25 @@ Vue.component('icon', {
9186 }
9287 } ,
9388 template : '#icon-template' ,
94- mounted ( ) {
95- fetch ( `./icons/${ this . name } .svg` )
96- . then ( response => {
97- if ( response . ok ) {
98- return response . text ( ) ;
99- }
100- throw new Error ( `Cannot find ${ this . name } .svg` ) ;
101- } )
102- . then ( svgText => {
103- const svgDocument = new DOMParser ( ) . parseFromString ( svgText , 'image/svg+xml' ) ;
104- const svgIcon = svgDocument . querySelector ( 'svg' ) . cloneNode ( true ) ;
105-
106- svgIcon . setAttribute ( 'width' , this . size ) ;
107- svgIcon . setAttribute ( 'height' , this . size ) ;
108-
109- this . $el . appendChild ( svgIcon ) ;
110- } )
111- . catch ( error => {
112- console . error ( error ) ;
113- } ) ;
89+ mounted : function mounted ( ) {
90+ var _this = this ;
91+
92+ fetch ( './icons/' + this . name + '.svg' ) . then ( function ( response ) {
93+ if ( response . ok ) {
94+ return response . text ( ) ;
95+ }
96+ throw new Error ( 'Cannot find ' + _this . name + '.svg' ) ;
97+ } ) . then ( function ( svgText ) {
98+ var svgDocument = new DOMParser ( ) . parseFromString ( svgText , 'image/svg+xml' ) ;
99+ var svgIcon = svgDocument . querySelector ( 'svg' ) . cloneNode ( true ) ;
100+
101+ svgIcon . setAttribute ( 'width' , _this . size ) ;
102+ svgIcon . setAttribute ( 'height' , _this . size ) ;
103+
104+ _this . $el . appendChild ( svgIcon ) ;
105+ } ) . catch ( function ( error ) {
106+ console . error ( error ) ;
107+ } ) ;
114108 }
115109} ) ;
116110
@@ -122,7 +116,7 @@ Vue.component('icon-container', {
122116 }
123117 } ,
124118 template : '#icon-container-template'
125- } )
119+ } ) ;
126120
127121new Vue ( {
128122 el : '#app' ,
0 commit comments