第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

取消后VueJS表單不會(huì)恢復(fù)到原始狀態(tài)

取消后VueJS表單不會(huì)恢復(fù)到原始狀態(tài)

我有一個(gè)應(yīng)用程序,用戶可以在其中手動(dòng)刪除帖子中的文本和文件附件。它工作正常,用戶可以刪除帖子中的文本和附件,但是,問(wèn)題是當(dāng)用戶選擇“取消”按鈕時(shí)——附件仍然顯示編輯過(guò)的附件項(xiàng)目。期望的結(jié)果是將附件恢復(fù)到原始列表。有人對(duì)我如何解決這個(gè)問(wèn)題有任何建議嗎?我在這里設(shè)置了一個(gè)演示:Codesandbox(單擊 POSTS --> POST ID --> EDIT POST --> 刪除附件 --> CANCEL EDIT)我正在使用道具將數(shù)據(jù)傳遞給子組件:父組件命名為PostDetail.vue:模板:<section v-if="editPostFormIsVis">      <EditPost        :post="post"        @update="editPostFormIsVis=false"        @cancel="editPostFormIsVis = false"        :attachmentsArray="attachmentsArray"        @deleteMediaAttachment="removeItem"      />    </section>腳本:import attachments from "../../public/attachments.json";import EditPost from "@/components/EditPost.vue";export default {  components: {    EditPost  },  data() {    return {      post: {},      editPostFormIsVis: false,      attachmentsArray: attachments    };  },  created() {    this.getPost();  },  methods: {    getPost() {      axios        .get(          "https://jsonplaceholder.typicode.com/posts/" + this.$route.params.id        )        .then(resp => {          this.post = resp.data;        })        .catch(err => {          console.log(err);        });    },    editPost() {      this.editPostFormIsVis = true;    },    removeItem: function(item) {      this.attachmentsArray.attachments.splice(item, 1);    }  },  computed: {    emailAttachmentsFileNames() {      if (this.attachmentsArray.emailAttachments) {        const emailAttachmentsFileNameArray = this.attachmentsArray.emailAttachments.map(          item => {            const tokens = item.split("/");            return tokens[tokens.length - 1];          }        );        return emailAttachmentsFileNameArray;      } else {        return null;      }    },  
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 316 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)