vuejs-select
by zarutofu
HTML
<html>
<body>
<form id="sample">
<select @change="changedHandle">
<option></option>
<option value="1">hoge</option>
<option value="2">piyo</option>
</select>
selected: {{ name }}
</form>
<script src="https://unpkg.com/[email protected]"></script>
</body>
</html>
JavaScript
new Vue({
el: '#sample',
data: {
name: ''
},
methods: {
changedHandle(e) {
if(e.target.options.selectedIndex > -1) {
this.name = e.target.options[e.target.options.selectedIndex].text;
}
}
}
})