【问题标题】:How to create UI in Meteor 1.4 with the templates如何使用模板在 Meteor 1.4 中创建 UI
【发布时间】:2016-10-24 12:59:13
【问题描述】:

我必须使用 Meteor 创建一个协作应用程序,但我一直在创建 UI。 我想为不同的页面设置一些按钮,但我想使用模板来执行此操作,这样我就不必加载另一个页面。 问题是我无法通过单击按钮来更改模板。 有没有人有一个小代码 sn-p 我可以用来解决我的问题?

提前致谢!!

【问题讨论】:

    标签: javascript user-interface templates meteor


    【解决方案1】:

    使按钮点击this.setState({templateName: template})

    然后在你的渲染中:

    if (this.setState.templateName == 'template1'){
        <Template1 />
    }else if (this.setState.templateName == 'template2'){
        <Template2 />
    }else etc
    

    您还可以在此处查看我制作的完整演示:https://github.com/Frazer/meteor-react-nav/tree/master/lib/jsx - 它以比我刚刚在此处提供的代码 sn-p 更复杂的方式呈现。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-09
    • 2014-07-23
    • 2013-04-08
    • 1970-01-01
    • 1970-01-01
    • 2016-11-15
    • 2016-01-02
    • 2012-05-03
    相关资源
    最近更新 更多