Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

注册函数时的参数说明不确切 #122

Open
anbang opened this issue Mar 31, 2017 · 0 comments
Open

注册函数时的参数说明不确切 #122

anbang opened this issue Mar 31, 2017 · 0 comments

Comments

@anbang
Copy link

anbang commented Mar 31, 2017

自定义的注册例子:


    function number_format(number, decimals, dec_point, thousands_sep){}
    juicer.register('beautifyAmount',number_format);//注册函数,用的时候使用注册的beaytifyAmount这个函数;
    //使用如下
    ${(item.amount/100)|beautifyAmount,"2",".",","}

这里的注册函数参数对应的

  • beautifyAmount 的第1个参数是管道分隔符前面的 (item.amount/100);
  • beautifyAmount 的第2个参数是 "2"
  • beautifyAmount 的第3个参数是 "."
  • beautifyAmount 的第4个参数是 ","

如果有1个以上的参数,注册函数名字后面用,分割;

-------下面是文档的介绍-------

${name|function, arg1, arg2}

感觉写成下面这样可能会更容易理解

${name|function, arg2, arg3}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant