Skip to content

Commit 0bbc708

Browse files
committed
fixbug
1 parent 0a1025c commit 0bbc708

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

_posts/2018-08-10-which-more-flask.markdown

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -703,22 +703,11 @@ def index():
703703
if __name__ == '__main__':
704704
app.run(debug=True)
705705
```
706+
706707
PS:模板继承的方法和django的一样。
707708

708709
3.宏
709710
只有定义的东西在很多地方去使用的时候才去用它,
710-
html
711-
```
712-
{% macro xx(name, type='text', value='') %}
713-
<input type="{{ type }}" name="{{ name }}" value="{{ value }}">
714-
  <input type="{{ type }}" name="{{ name }}" value="{{ value }}">
715-
  <input type="{{ type }}" name="{{ name }}" value="{{ value }}">
716-
717-
{% endmacro %}
718-
719-
{{ xx('n1') }}
720-
```
721-
722711
相当于在页面上定义了一个名为xx的'函数',这个函数接收3个参数,我们给type和value写上了默认值,
723712
此时调用,我们还需要传入一个参数,我们此时传入了一个n1,则
724713
页面上会生成3个input框,name都为n1

0 commit comments

Comments
 (0)