下圖是我的 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>
如何在我的 JSON 中獲取 URL 并將其放入模態?
HUWWW
2021-07-09 14:01:30