美文网首页
Flask-带参数的宏的的定义

Flask-带参数的宏的的定义

作者: 测试探索 | 来源:发表于2020-09-27 06:46 被阅读0次

    启动上一篇运行的代码,文件macro_test.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        {% macro input() %}
        <input type="text" value="" size="30">
        {% endmacro %}
    
        <h1>input 1</h1>
        {{ input() }}
    
        <h1>input 2</h1>
        {{ input() }}
    
        <hr/>
        {% macro input2(type,value,size) %}
        <input type="{{ type }}" value="{{ value }}" size="{{ size }}">
        {% endmacro %}
    
        <h1>input 2</h1>
        {{ input2("password","",50) }}
    </body>
    </html>
    

    相关文章

      网友评论

          本文标题:Flask-带参数的宏的的定义

          本文链接:https://www.haomeiwen.com/subject/omghuktx.html