Git Product home page Git Product logo

Comments (3)

zhenglibao avatar zhenglibao commented on June 3, 2024

这个自定义宏不支持添加参数,请问什么场景下需要使用参数?另外你希望这个参数如何在xml中传递呢?

from flexlib.

wayone avatar wayone commented on June 3, 2024

场景:某个距离不是死的,要根据屏幕宽度做比例,例如:$marginLeft: 10*某个比例。
使用方式:在 OC 里面,宏里面传递参数很常见。就是说,我写的这个宏,他能够传入一个参数,然后处理一下,再返回一个值。假设 A() 是一个宏,希望这么使用,$marginLeft:A(10)。

如果宏的实现比较简单,用表达式也行。但是我要在很多地方使用,所以同样的表达式我要写很多遍,感觉用 A(10) 这种比较方便,并且把实现统一到一起了,如果以后要修改,只改一个地方就行了。

from flexlib.

zhenglibao avatar zhenglibao commented on June 3, 2024

场景:某个距离不是死的,要根据屏幕宽度做比例,例如:$marginLeft: 10*某个比例。 使用方式:在 OC 里面,宏里面传递参数很常见。就是说,我写的这个宏,他能够传入一个参数,然后处理一下,再返回一个值。假设 A() 是一个宏,希望这么使用,$marginLeft:A(10)。

如果宏的实现比较简单,用表达式也行。但是我要在很多地方使用,所以同样的表达式我要写很多遍,感觉用 A(10) 这种比较方便,并且把实现统一到一起了,如果以后要修改,只改一个地方就行了。

后续版本可以考虑支持参数

from flexlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.