Created
September 26, 2019 10:43
-
-
Save smokeyfro/ddd97bac76fafac1a9c90f5c0c744bac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="relative"> | |
<Dropdown | |
:options="$page.places.edges.map(e => e.node)" | |
v-on:selected="submit" | |
:disabled="false" | |
name="dropdown" | |
:maxItem="600" | |
class="text-left" | |
placeholder="Please select an option"> | |
</Dropdown> | |
<button type="submit" v-on:click.prevent="submit()" class="relative z-50">Go</button> | |
</div> | |
</template> | |
<page-query> | |
query Posts { | |
places: allPlace ( sortBy: "title", order: ASC) { | |
edges { | |
node { | |
id | |
path | |
title | |
name | |
} | |
} | |
} | |
} | |
</page-query> | |
<script> | |
import Dropdown from 'vue-simple-search-dropdown'; | |
export default { | |
components: { | |
Dropdown | |
}, | |
methods: { | |
submit(){ | |
this.$router.push(this.matches[selected.path]) | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment