Passing PHP variable to vue.js vue component
Hi everyone, I am working on a php site where I want to pass a php string variable to be used in a .vue component. Can someone help me wit this?
here is what i have in code: index.php
<?php
$foo = 72;
?>
<div id='app'></div>
app.js
import App from './views/App';
new Vue({
el: '#app',
render: h => h(App)
});
App.vue
<template>
</template>
<script>
export default {
name: 'App',
data() {
return {
foo: ''
}
}
}
</script>
<style></style>
As you can see in index.php, $foo = 72. I want that 72 value will be pass on to $foo in App.vue