I am working on a wordpress site where I need to pass a php string variable to a .vue component so that one of the vue variable will reflect the value of the php varaible
index.php
<?php
$foo = 72;
?>
<div id='app'></div>
app.js
import App from './views/App';
new Vue({
el: '#app',
render: h => h(App)
});
./views/App.vue
<template>
<h1>{{ foo }}</h1>
</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