Skip to content

Instantly share code, notes, and snippets.

@asvae
Created January 8, 2016 10:24
Show Gist options
  • Save asvae/878b962ba9154c581802 to your computer and use it in GitHub Desktop.
Save asvae/878b962ba9154c581802 to your computer and use it in GitHub Desktop.
<template>
<select name="name" class="form-control" v-model="value">
<option :value="null" :selected="value === null">{{noProgrammer}}
</option>
<option v-for="(user_id, user_name) in apiProgrammers.data"
:value="user_id" :selected="value == user_id"
v-text="user_name"></option>
</select>
</template>
<script>
module.exports = {
data: function () {
return {
null: null, // NOTE Required for select to support null value.
apiProgrammers: this.$api.load('users/programmers'),
noProgrammer: 'Не назначен'
}
},
props: {
name: {type: String},
value: {},
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment