File tree Expand file tree Collapse file tree 1 file changed +18
-19
lines changed Expand file tree Collapse file tree 1 file changed +18
-19
lines changed Original file line number Diff line number Diff line change 1- import { App , defineComponent , computed } from 'vue'
1+ import { App , computed , defineComponent , h } from 'vue'
22import { SvgSpriteOptions , SvgSpritePluginOptions } from './defs'
33import { getAttributes , getHref } from './utils'
44
55const name = 'SvgSprite'
66const options : SvgSpriteOptions = { } as SvgSpriteOptions
77export const SvgSprite = defineComponent ( {
88 name,
9- template : `
10- <svg
11- :class="cssClass"
12- :viewBox="attrs.viewBox"
13- :width="attrs.width"
14- :height="attrs.height"
15- role="presentation"
16- >
17- <use xmlns:xlink="http://www.w3.org/1999/xlink"
18- :xlink:href="href"
19- :href="href"
20- ></use>
21- </svg>` ,
229 props : {
2310 symbol : {
2411 type : String ,
@@ -50,11 +37,23 @@ export const SvgSprite = defineComponent({
5037 // SVG attributes
5138 const attrs = computed ( ( ) => getAttributes ( props . size ) )
5239
53- return {
54- cssClass : options . class ,
55- href,
56- attrs,
57- }
40+ return ( ) =>
41+ h (
42+ 'svg' ,
43+ {
44+ role : 'presentation' ,
45+ class : options . class ,
46+ width : attrs . value . width ,
47+ height : attrs . value . height ,
48+ viewBox : attrs . value . viewBox ,
49+ } ,
50+ h ( 'use' , {
51+ 'xmlns:xlink' : 'http://www.w3.org/1999/xlink' ,
52+ // eslint-disable-next-line quote-props
53+ href : href . value ,
54+ 'xlink-href' : href . value ,
55+ } )
56+ )
5857 } ,
5958} )
6059
You can’t perform that action at this time.
0 commit comments