Skip to content

Instantly share code, notes, and snippets.

@Meekohi
Created November 7, 2018 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Meekohi/93cc6ea2c3d202806762245d93a5351a to your computer and use it in GitHub Desktop.
Save Meekohi/93cc6ea2c3d202806762245d93a5351a to your computer and use it in GitHub Desktop.
Vue-Select - Custom Labels
<div id="app">
<h1>Vue Select - Custom Labels</h1>
<v-select label="countryName" :options="options"></v-select>
</div>
Vue.component("v-select", VueSelect.VueSelect);
new Vue({
el: "#app",
data: {
options: [
{ countryCode: "AU", countryName: "Australia" },
{ countryCode: "CA", countryName: "Canada" },
{ countryCode: "CN", countryName: "China" },
{ countryCode: "DE", countryName: "Germany" },
{ countryCode: "JP", countryName: "Japan" },
{ countryCode: "MX", countryName: "Mexico" },
{ countryCode: "CH", countryName: "Switzerland" },
{ countryCode: "US", countryName: "United States" }
]
}
});
<script src="https://unpkg.com/vue@latest"></script>
<script src="https://unpkg.com/vue-select@latest"></script>
body {
font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
}
h1 {
font-size: 26px;
font-weight: 600;
color: #2c3e5099;
text-rendering: optimizelegibility;
-moz-osx-font-smoothing: grayscale;
-moz-text-size-adjust: none;
}
#app {
max-width: 30em;
margin: 1em auto;
}
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:600" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment