Flask-带参数的宏的的定义

2020-09-27  本文已影响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>
上一篇 下一篇

猜你喜欢

热点阅读