How can I add condition on vue component that is loaded from the view blade laravel?

后端 未结 1 1038
一生所求
一生所求 2020-12-07 05:11

My view blade laravel like this :

@extends(\'layouts.app\')
@section(\'content\')
    ...
        
    ...
@endsectio         


        
相关标签:
1条回答
  • 2020-12-07 06:02

    You are mixing of instantiation of Vue components and Bootstrap's modals event triggered.

    What you can do is using Bootstrap modal events. Example code below:

    <template>
        <div id="modal-transaction" class="modal fade" tabindex="-1" role="dialog">
            ...
        </div>
    </template>
    <script>
        export default {
            methods: {
                onModalOpen() {
                    // Do something when modal opens
                },
                onModalClose() {
                    // Do something when modal closed
                }
            },
            mounted() {
                $('#modal-transaction').on('shown.bs.modal', this.onModalOpen.bind(this))
                $('#modal-transaction').on('hidden.bs.modal', this.onModalClose.bind(this))
            }
        }
    </script>
    
    0 讨论(0)
提交回复
热议问题