I am getting an error while incorporating this into a fresh Laravel 5.3 install.
[vuex] already installed. Vue.use(Vuex) should be called only once.
[Vue warn]: The "data" option should be a function that returns a per-instance value in component definitions.
[Vue warn]: Error when evaluating expression "function sharedAddress() {
return _Store2.default.state.sharedAddress;
}": TypeError: Cannot read property 'sharedAddress' of undefined (found in component: <example>)
<template>
<google-autocomplete
class = "input"
placeholder = "type your address"
>
</google-autocomplete>
</template>
<script>
import Store from 'google-autocomplete-vue/dist/Store';
import Components from 'google-autocomplete-vue';
console.log(Store);
export default {
ready() {
console.log('Component ready.')
},
data: {
output: {}, address: {}, sent: false
},
computed:{
sharedAddress: function(){
return Store.state.sharedAddress;
}
},
watch: {
sharedAddress: function (){
this.address = this.sharedAddress;
}
},
methods:{
submit: function (){
this.sent = true;
this.output = this.address;
this.address = {};
},
isValid: function (){
return Object.keys(this.output).length > 0;
},
isNotValid: function (){
return ! this.isValid();
}
}
}
</script>
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Dashboard</div>
<example></example>
</div>
</div>
</div>
@endsection
"dependencies": {
"google-autocomplete-vue": "^1.0.12",
"vue": "^1.0.28",
"vuex": "^2.1.1"
}