如何使用VuetifyJS的高级插槽示例与Google Places API配合使用?
CodePen示例
<v-autocomplete
v-model="model"
:items="items"
:loading="isLoading"
:search-input.sync="search"
chips
clearable
hide-details
hide-selected
item-text="name"
item-value="symbol"
label="Search for a coin..."
solo
>
<template slot="no-data">
<v-list-tile>
<v-list-tile-title>
Search for your favorite
<strong>Cryptocurrency</strong>
</v-list-tile-title>
</v-list-tile>
</template>
<template
slot="selection"
slot-scope="{ item, selected }"
>
<v-chip
:selected="selected"
color="blue-grey"
class="white--text"
>
<v-icon left>mdi-coin</v-icon>
<span v-text="item.name"></span>
</v-chip>
</template>
<template
slot="item"
slot-scope="{ item, tile }"
>
<v-list-tile-avatar
color="indigo"
class="headline font-weight-light white--text"
>
{{ item.name.charAt(0) }}
</v-list-tile-avatar>
<v-list-tile-content>
<v-list-tile-title v-text="item.name"></v-list-tile-title>
<v-list-tile-sub-title v-text="item.symbol"></v-list-tile-sub-title>
</v-list-tile-content>
<v-list-tile-action>
<v-icon>mdi-coin</v-icon>
</v-list-tile-action>
</template>
</v-autocomplete>
我在Google开发者控制台中添加了Google Maps Geocoding API、Google Places API Web Service和Google Maps Javascript API,并获得了API密钥。