I am using Laravel spark with Vuejs but when I create a new instance of Vue and include it in my main.js file it my elements don't get shown when a specific option is selected:
Here is my Vue instance file contents called traffic.js:
var one = new Vue({
el:'#hidable,
data: {
traffic:'all'
}
})
And here is my markup:
<div id="hidable">
<select v-model="traffic">
<option value="all">All</option>
<option value="organic">SEO traffic</option>
<option value="social">Social media</option>
</select>
<span v-if="traffic === 'all'">You have selected all traffic</span>
<span v-else-if="traffic === 'organic'">You have selected SEO traffic</span>
<span v-else-if="traffic === 'social'"> You have selected social media traffic</span>
</div>
My main app.js looks like this:
import Vue from 'vue'
import BootstrapVue from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
Vue.use(BootstrapVue);
////
require('spark-bootstrap');
require('./components/bootstrap');
require('./traffic')
var app = new Vue({
mixins: [require('spark')],
});
Since I set traffic as all in the data of The Vue instance then the first span is visible when the page loads but changing the option in the select menu doesn't change the behaviour and its not responsive.
Any ideas what I am doing wrong?