Git Product home page Git Product logo

Comments (6)

PaulGuo avatar PaulGuo commented on July 26, 2024

可以这么做:

juicer.register('get_page_count', get_page_count); // get_page_count is a function
{@if get_page_count(total) >10}
    xxxxxxxxxx
{@/if}

from juicer.

pulo avatar pulo commented on July 26, 2024

其实我一直觉得 一些简单的运算是否可以在模板里进行。
因为我模板和JS文件是分离的
JS提供数据
模板怎么处理数据应该是模板的事情。

from juicer.

PaulGuo avatar PaulGuo commented on July 26, 2024

如果想把helper的定义放进模板中也是可以的,但是还是建议将helper分离出来。模板中可以通过

<% some code; %>

嵌入原生js代码,这么做可能会让模板看起来很凌乱,后期维护可能也不方便,具体还要看你的场景而定。

from juicer.

pulo avatar pulo commented on July 26, 2024

嘿嘿 这就又回到我之前问到的一个问题了 那就是 <%%>里怎么读取到模板数据~~

from juicer.

PaulGuo avatar PaulGuo commented on July 26, 2024

<% %>中直接可以取到传入的数据的,诸如:

juicer('<% console.log(a); %>', {a: 123});

from juicer.

pulo avatar pulo commented on July 26, 2024

哦? 行吗?我好像之前试了不行~~~好的 谢谢 我回头看看,可能我写错了~

from juicer.

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.