不確定這里發生了什么,但是當我單擊調用函數的按鈕時,它不會顯示我的模態。函數調用本身有效,因為如果我取消注釋,注釋掉的警報將顯示。我如何需要在此方法中顯示模態?控制臺中也沒有錯誤<button @click="eventClick"></button><div id="example-modal"> <!-- Modal --> <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Modal title</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> hihi </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> </div> </div> </div>eventClick: function(e) { var eventObj = e.event; //alert('Clicked ' + eventObj.title); let element = this.$refs.modal.$el; $(element).modal('show');
在調用的 vue 方法中顯示模式
喵喵時光機
2021-10-14 16:46:01