File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 1+ #
12# out: ../icon-font-compatible.js
23i = require " ./icon"
34ifc =
5+ template : i .template
46 mixins : i .mixins
7+ data : ->
8+ style : null
9+ attached : ->
10+ @style = window .getComputedStyle (@$el )
511 props :
612 name : i .props .name
713 flip : i .props .flip
@@ -11,14 +17,11 @@ ifc =
1117 box : i .computed .box
1218 flipped : i .computed .flipped
1319 height : ->
14- @style = window .getComputedStyle (@$el ) unless @style
15- return @style .getPropertyValue (" font-size" ).replace (" px" ," " )
16- width : ->
17- if @height ?
18- @icon .w / @icon .h * @height
20+ if @style
21+ return parseFloat @style .getPropertyValue (" font-size" ).replace (" px" ," " )
1922 return null
23+ width : -> @icon .w / @icon .h * @height
2024 marginTop : ->
21- @style = window .getComputedStyle (@$el ) unless @style
2225 height = parseInt @style .getPropertyValue (" line-height" ).replace (" px" ," " )
2326 return (height- @height )/ 2 + ' px'
2427
Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ module.exports =
3535 hcenter :
3636 type : Boolean
3737 default : false
38-
38+ data : ->
39+ parent : null
40+ attached : ->
41+ @parent = @$el .parentElement
3942 computed :
4043 icon : ->
4144 tmp = @name .split (" -" )
@@ -59,8 +62,8 @@ module.exports =
5962 else
6063 return null
6164 marginTop : ->
62- if @hcenter and @$el . parentElement ?
63- return (@$el . parentElement .clientHeight - @height )/ 2 + ' px'
65+ if @hcenter and @parent ?
66+ return (@parent .clientHeight - @height )/ 2 + ' px'
6467 return null
6568
6669 </script >
You can’t perform that action at this time.
0 commit comments