zoukankan      html  css  js  c++  java
  • 消息闪现

    #消息闪现
    @book_bp.route("/book", methods=["GET", "POST"])
    def handle_book():
        if request.method == "POST":
            title = request.form.get("title")
            if title:
                books.append(title)
                flash("Add book succussfully.")
                return redirect(url_for("book.handle_book"))
            else:
                flash("Add failed", "error")
        return render_template("book.html", books=books)
    
    #jinja模版中使用
        {% for message in get_flashed_messages()%}
            {{ message }}
        {% endfor %}
    
        {% with error_message = get_flashed_messages(category_filter=["error"]) %}
            {% for error in error_message %}
                {{ error }}
            {% endfor %}
        {% endwith %}
  • 相关阅读:
    vue组件的通信
    vue基础
    vue项目总结
    路由(4)传参
    路由(3)
    第一次作业
    JAVA-2.0-homework
    JAVA-2.0-上机
    JAVA-1.9-homework
    JAVA-1.9-上机
  • 原文地址:https://www.cnblogs.com/themost/p/9272044.html
Copyright © 2011-2022 走看看