-
Notifications
You must be signed in to change notification settings - Fork 89
/
app.vue
55 lines (46 loc) · 1.13 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<template>
<div>
<autocomplete
url="https://maps.googleapis.com/maps/api/geocode/json?address="
anchor="formatted_address"
label="geometry.location.lat"
name="autocomplete"
:customParams="{ token: 'dev' }"
:classes="{ input: 'form-control', wrapper: 'input-wrapper'}"
:process="processJSON"
:onSelect="handleSelect"
>
</autocomplete>
<pre v-if="preContent" :style="preStyle">
<b>Selected Data:</b>
{{ preContent }}
</pre>
</div>
</template>
<script>
import Autocomplete from './vue-autocomplete.vue';
require("../../../dist/style/vue2-autocomplete.css")
export default {
components: { Autocomplete },
data () {
return {
preContent: "",
preStyle: {
background: "#f2f2f2",
fontFamily: "monospace",
fontSize: "1em",
display: "inline-block",
padding: "15px 7px",
}
}
},
methods: {
processJSON(json) {
return json.results;
},
handleSelect(data) {
this.preContent = JSON.stringify(data, null, 4)
}
}
};
</script>