Vue.js 如何使用cacth';隐藏.bs.modal';在vuejs?

Vue.js 如何使用cacth';隐藏.bs.modal';在vuejs?,vue.js,bootstrap-4,bootstrap-modal,laravel-5.6,Vue.js,Bootstrap 4,Bootstrap Modal,Laravel 5.6,我想处理eventhidden.bs.modal以清除变量中的数据 但它似乎不再起作用了 <template> <div id="my_modal" class="modal" tabindex="-1" role="dialog" aria-hidden="true" ref="my_modal"> ... </div> </tem

我想处理event
hidden.bs.modal
以清除变量中的数据

但它似乎不再起作用了

<template>
    <div id="my_modal"
         class="modal"
         tabindex="-1"
         role="dialog"
         aria-hidden="true"
         ref="my_modal">
        ...
    </div>
</template>

<script>
    export default {
        mounted() {
            $(this.$refs.my_modal).on('hidden.bs.modal', this.doSomething());
        },

        methods: {
            doSomething() {
                // Do something
            },
        },
    }
</script>

...
导出默认值{
安装的(){
$(this.$refs.my_modal).on('hidden.bs.modal',this.doSomething());
},
方法:{
doSomething(){
//做点什么
},
},
}

在doSomething之后不需要括号。您希望传递函数本身,而不是它的结果

 mounted() {
     $(this.$refs.my_modal).on('hidden.bs.modal', this.doSomething);
 },

它是如何不起作用的?你在控制台中有什么错误?@ThunderBirdsX3你在做其他错误。下面是代码的工作示例:但如果您可以,我建议您使用vue引导,例如,是的,它有一些错误。我使用了
laravelmix
,这个问题来自于这个软件包。这里有更多细节