-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.js
48 lines (46 loc) · 935 Bytes
/
template.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function template (data) {
return `
const ${data.componentName} = {
functional: true,
name: '${data.componentName}',
props: {
height: {
type: [String, Number],
default: 24
},
width: {
type: [String, Number],
default: 24
},
viewBox: {
type: String
},
className: {
type: [Object, Array, String]
},
styles: {
type: [Object, Array, String]
}
},
render (h, ctx) {
const svg = h('svg', {
class: ctx.props.className,
style: ctx.props.styles,
attrs: {
height: ctx.props.height,
width: ctx.props.width,
preserveAspectRatio:'xMidYMid meet',
viewBox: ctx.props.viewBox || '${data.viewBox}',
fill: 'currentColor',
},
domProps: {
innerHTML:'<g>${data.content}</g>'
}
})
return svg
}
}
export default ${data.componentName}
`
}
module.exports = template