首页 > 解决方案 > 输入 texbox 上的 V- 模型在 django for 循环中更新其他 v 模型输入文本上的文本

问题描述

我有这个 Django for 循环,我有这个带有 v 模型的输入文本框的表单。当我在它上面输入一个文本时,它会在这个 django for 循环中更新输入 texbox 上的文本:

{% for drama in theatre %}
     <div class="comment-input" id="postcomment-{{tweet.id}}">
       <form v-on:submit.prevent="submit0comment({{tweet.id}})" id="comment-{{tweet.id}}" >
          <input id=".input_1"  type="text"  v-model="comment_body"   class="form-control">
          <div class="fonts">
              <button  class="btn-share">Post</button> 
           </div>
       </form>
     </div>
     <br>
      <div class="d-flex flex-row mb-2" v-for="comment in comments"> 
          <img :src="comment.avatar" width="40" class="rounded-image">
             <div class="d-flex flex-column ml-2"> 
                <span class="name">[[comment.commenter]]</span> 
                    <small class="comment-text">[[ comment.comment_body]]</small>
                    <div class="d-flex flex-row align-items-center status"> 
                        <small>Like</small> 
                        <small>Reply</small> 
                        <small>[[ comment.created_at ]]</small> 
                    </div>
                </div>
     </div>
{% endfor %}

标签: python-3.xdjangovue.jsv-model

解决方案


推荐阅读