<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ### 1.相關鏈接 定制工具欄圖標:[http://fex.baidu.com/ueditor/\#start-toolbar](http://fex.baidu.com/ueditor/#start-toolbar) ### 2.完整的按鈕列表 ``` toolbars: [ [ 'anchor', //錨點 'undo', //撤銷 'redo', //重做 'bold', //加粗 'indent', //首行縮進 'snapscreen', //截圖 'italic', //斜體 'underline', //下劃線 'strikethrough', //刪除線 'subscript', //下標 'fontborder', //字符邊框 'superscript', //上標 'formatmatch', //格式刷 'source', //源代碼 'blockquote', //引用 'pasteplain', //純文本粘貼模式 'selectall', //全選 'print', //打印 'preview', //預覽 'horizontal', //分隔線 'removeformat', //清除格式 'time', //時間 'date', //日期 'unlink', //取消鏈接 'insertrow', //前插入行 'insertcol', //前插入列 'mergeright', //右合并單元格 'mergedown', //下合并單元格 'deleterow', //刪除行 'deletecol', //刪除列 'splittorows', //拆分成行 'splittocols', //拆分成列 'splittocells', //完全拆分單元格 'deletecaption', //刪除表格標題 'inserttitle', //插入標題 'mergecells', //合并多個單元格 'deletetable', //刪除表格 'cleardoc', //清空文檔 'insertparagraphbeforetable', //"表格前插入行" 'insertcode', //代碼語言 'fontfamily', //字體 'fontsize', //字號 'paragraph', //段落格式 'simpleupload', //單圖上傳 'insertimage', //多圖上傳 'edittable', //表格屬性 'edittd', //單元格屬性 'link', //超鏈接 'emotion', //表情 'spechars', //特殊字符 'searchreplace', //查詢替換 'map', //Baidu地圖 'gmap', //Google地圖 'insertvideo', //視頻 'help', //幫助 'justifyleft', //居左對齊 'justifyright', //居右對齊 'justifycenter', //居中對齊 'justifyjustify', //兩端對齊 'forecolor', //字體顏色 'backcolor', //背景色 'insertorderedlist', //有序列表 'insertunorderedlist', //無序列表 'fullscreen', //全屏 'directionalityltr', //從左向右輸入 'directionalityrtl', //從右向左輸入 'rowspacingtop', //段前距 'rowspacingbottom', //段后距 'pagebreak', //分頁 'insertframe', //插入Iframe 'imagenone', //默認 'imageleft', //左浮動 'imageright', //右浮動 'attachment', //附件 'imagecenter', //居中 'wordimage', //圖片轉存 'lineheight', //行間距 'edittip ', //編輯提示 'customstyle', //自定義標題 'autotypeset', //自動排版 'webapp', //百度應用 'touppercase', //字母大寫 'tolowercase', //字母小寫 'background', //背景 'template', //模板 'scrawl', //涂鴉 'music', //音樂 'inserttable', //插入表格 'drafts', // 從草稿箱加載 'charts', // 圖表 ] ] ``` ### 3.實例 ``` $(function () { var ue = UE.getEditor("editor",{ 'serverUrl':'/ueditor/upload/', toolbars: [[ 'undo', //撤銷 'redo', //重做 'bold', //加粗 'italic', //斜體 'blockquote', //引用 'selectall', //全選 'insertcode', //代碼語言 'fontfamily', //字體 'fontsize', //字號 'paragraph', //段落格式 'simpleupload', //單圖上傳 'emotion', //表情 'searchreplace', //查詢替換 'insertvideo', //視頻 'justifyleft', //居左對齊 'justifyright', //居右對齊 'justifycenter', //居中對齊 'justifyjustify', //兩端對齊 'forecolor', //字體顏色 ]] }); }); ``` ``` <script src="{{ static("front/js/pdetail.js") }}"></script> <script id="editor" type="text/plain"></script> ``` ### 4.定義評論模型 ``` class CommentModel(db.Model): __tablename__ = "comment" id = db.Column(db.Integer,primary_key=True,autoincrement=True) content = db.Column(db.Text,nullable=False) create_time = db.Column(db.DateTime,default=datetime.now) post_id = db.Column(db.Integer,db.ForeignKey("post.id")) author_id = db.Column(db.String(100),db.ForeignKey("front_user.id"),nullable=False) post = db.relationship("PostModel",backref="comments") author = db.relationship("FrontUser",backref="comments") ``` ### 5.定義添加評論視圖 ``` @bp.route('/acomment/') @login_required def add_comment(): form = AddCommentForm(request.form) if form.validate(): content = form.content.data # 通過帖子id,判斷是否有當前帖子 post_id = form.post_id.data post = PostModel.query.get(post_id) if post: comment = CommentModel(content=content) comment.post = post comment.author = g.front_user db.session.add(comment) db.session.commit() return restful.success() else: return restful.params_error("沒有這篇帖子!") else: return restful.params_error(form.get_error()) ``` ### 6.前端評論布局 ``` <div class="comment-group"> <h3>評論列表</h3> <ul class="comment-list-group"> {% for comment in post.comments %} <li>{{ comment.content }}</li> {% endfor %} </ul> </div> <div class="add-comment-group"> <h3>發表評論</h3> <script id="editor" type="text/plain" style="height:100px;"></script> <div class="comment-btn-group"> <button class="btn btn-primary">發表評論</button> </div> </div> </div> ``` 樣式表 ``` .comment-group{ margin-top:20px; border:1px solid #e8e8e8; padding:10px; } .add-comment-group{ margin-top: 20px; padding:10px; border:1px solid #e8e8e8; } .add-comment-group h3{ margin-bottom: 10px; } .comment-btn-group{ margin-top: 10px; text-align: right; } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看