After a while i found a Solution (Workaround):
The only way possible i know to comunicate between normal javascript, PHP, Laravel and Vuejs, is using html tags as intermediaries, from them you can do all sort of stuff.
You can set any value from vue to a hidden input or a any DOM data, and read after from javascript, you can also trigger DOM events from Vue, and execute them in your regular Javascript.
This is a Workaround, since this is not optimal use of Vuejs, but if you need to use Vue and still use normal javascript, hope this will help you.
For example, to trigger a variable change in vue to Javascript:
In your Vue component:
<template>
<input type="text" v-model="my_value" onchange="vanillaFunction(this.value)">
</template>
<script>
export default {
name: 'test-vue',
data: function (){
return {
my_value: 'start',
}
},
created: function () {
this.my_value = 'finish'
},
mounted: function () {
this.my_value = 'mounted'
},
watch: {
my_value: function (val) {
$("input#my_value").trigger('change')
},
},
};
</script>
In your javascript file:
function vanillaFunction(value){
console.log('Vue has changed the value to: ' + value)
}