Comments (3)
这个自定义宏不支持添加参数,请问什么场景下需要使用参数?另外你希望这个参数如何在xml中传递呢?
from flexlib.
场景:某个距离不是死的,要根据屏幕宽度做比例,例如:$marginLeft: 10*某个比例。
使用方式:在 OC 里面,宏里面传递参数很常见。就是说,我写的这个宏,他能够传入一个参数,然后处理一下,再返回一个值。假设 A() 是一个宏,希望这么使用,$marginLeft:A(10)。
如果宏的实现比较简单,用表达式也行。但是我要在很多地方使用,所以同样的表达式我要写很多遍,感觉用 A(10) 这种比较方便,并且把实现统一到一起了,如果以后要修改,只改一个地方就行了。
from flexlib.
场景:某个距离不是死的,要根据屏幕宽度做比例,例如:$marginLeft: 10*某个比例。 使用方式:在 OC 里面,宏里面传递参数很常见。就是说,我写的这个宏,他能够传入一个参数,然后处理一下,再返回一个值。假设 A() 是一个宏,希望这么使用,$marginLeft:A(10)。
如果宏的实现比较简单,用表达式也行。但是我要在很多地方使用,所以同样的表达式我要写很多遍,感觉用 A(10) 这种比较方便,并且把实现统一到一起了,如果以后要修改,只改一个地方就行了。
后续版本可以考虑支持参数
from flexlib.
Related Issues (20)
- 如果能提供数据和界面之间的绑定,就再好不过 HOT 5
- 一点小建议 HOT 5
- 支不支持动画? HOT 1
- stickTop:true无效,官方demo也没有任何效果 HOT 3
- 喜欢flex布局的便捷,和Texture框架比较怎么选择? HOT 9
- 转义字符好像玩不转 HOT 1
- how to user Macro FLEXSET in swift HOT 2
- 如何添加for 增加多个大小不一视图能力,并对应绑定视图 HOT 1
- 预览模块如何只在 debug 下使用 HOT 4
- 自定义宏,不管用 HOT 4
- 控件平移等动画
- 样式 class 的使用
- 请问如何使用xml进行App主题颜色的适配?
- xml文件里,第一次触摸到 UITextField 后,就滑动不了了。 HOT 2
- FlexShowToast有时好使,有时不好使 HOT 2
- pod 问题。。 HOT 1
- 热加载 HOT 1
- FlexLib 做阿拉伯适配 . 设置 direction:rtl . 无效呢
- Xcode14.3 报错 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flexlib.