Suppose I am utilizing an external package like vue-js-modal
and have imported it in the file /plugins/vue-js-modal.js
:
import Vue from 'vue'
import VModal from 'vue-js-modal'
Vue.use(VModal)
Imagine I have a function that utilizes vue-js-modal
and I want to use it across various components:
function showHideModal(showModalName = null, hideModalName = null) {
if (hideModalName) {
this.$modal.hide(hideModalName)
}
if (showModalName) {
this.$modal.show(showModalName)
}
}
Should this function be kept in /plugins/vue-js-modal.js
, or should it be moved into its own separate file such as /mixins/showHideModal.js
? Which option is more suitable in this scenario and why?