亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在我的 JSON 中獲取 URL 并將其放入模態?

如何在我的 JSON 中獲取 URL 并將其放入模態?

HUWWW 2021-07-09 14:01:30
下圖是我的 JSON 結構,它來自 MYSQL 并使用 NodeJS 檢索,我現在將它呈現給我的 VueJS。這是我的錯誤/錯誤的視頻。如您所見,即使我只單擊一個,它也會顯示每個用戶的所有 QR。它給了我表中每個人的 URL我只需要顯示每個用戶。下面的代碼工作正常,直到我將此代碼插入我的模式 ":value="result.url" :size="size" level="H">雖然它仍然有效但不是我想要的。<tbody>    <tr v-for="result in filteredPeople" :key="result.id">        <td>{{result.Memb_ID}}</td>        <th>{{result.First_Name}}</th>        <th>{{result.Middle_Name}}</th>        <th>{{result.Last_Name}}</th>        <th>{{result.Address}}</th>        <div class="btn">            <button type="button" class="btn btn-success">Edit Details</button>            <b-button v-b-modal.modal-1 class="btn btn-danger">Show QR</b-button>        </div>        <b-modal id="modal-1" title="QR">            <div class="showQR text-center">                <qrcode-vue :value="result.url" :size="size" level="H"/>            </div>        </b-modal>    </tr></tbody><script>           import axios from "axios";    import QrcodeVue from "qrcode.vue";    export default {                    data() {        return {          search: "",          value: "",          size: 250,          results: {}        };       },     methods: {        getUsers() {          axios            .get("http://localhost:9000/api/users/")            .then(response => (this.results = response.data))            .catch(error => console.log(error));        }      },    computed: {        filteredPeople() {          if (this.search) {            return this.results.filter(result => {              return result.First_Name.startsWith(this.search);            });          } else {            return this.results;          }        }      },      components: {        QrcodeVue      }    };</script>
查看完整描述

2 回答

?
撒科打諢

TA貢獻1934條經驗 獲得超2個贊


您應該為每個項目使用不同的模態 ID v-for


<div class="btn">

  <button type="button" class="btn btn-success">Edit Details</button>

  <b-button v-b-modal="'modal-' + result.Memb_ID" class="btn btn-danger">Show QR</b-button>

</div >


<b-modal :id="'modal-' + result.Memb_ID" title="QR">

  <div class="showQR text-center">

    <qrcode-vue : value="result.url" :size="size" level="H"/>

          </div>

</b-modal>


查看完整回答
反對 回復 2021-07-15
  • 2 回答
  • 0 關注
  • 213 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號