Open RezaErfani67 opened 2 years ago
Is it okay in the old version?
Yes It works good on 2.1.4
I tried some mixins case and use v2.2.0
of v-diaogs, it's work fine, can you post more content to help find issues.
mixins.js
file
export default {
methods: {
upperCase (text) {
if (!text) return ''
return text.toUpperCase()
}
}
}
Profile.vue
to display in Modal
<template>
<div>
<!-- result: `THIS IS TEXT` -->
<span v-text="upperCasedText()" />
</div>
</template>
<script>
import mixins from './mixins'
export default {
mixins: [mixins],
methods: {
upperCasedText () {
// call upperCase function from mixins.js
return this.upperCase('This is text.')
}
}
}
</script>
In page
import Profile from './Profile.vue'
export default {
methods: {
business () {
this.$dlg.modal(Profile, {
...parameters
})
}
}
}
its my function in global mixins:
Vue.mixin({ ... }))
i18nMixin:function(key){return i18n.t(key)},
I still using my example case and modified like below
main.js
setup globally mixin
import mixins from './mixins'
Vue.mixin(mixins)
Profile.vue
to display in Modal
<template>
<div>
<!-- result: `THIS IS TEXT` -->
<span v-text="upperCasedText()" />
</div>
</template>
<script>
export default {
methods: {
upperCasedText () {
// call upperCase function from mixins.js
return this.upperCase('This is text.')
}
}
}
</script>
upperCase
function call succeeded.
v2.2.0 not detect mixin function cal modal:
inside modal i have this button: