NCNU_Course/js/components/chooseDepartment.vue
snsd0805 b77cd4340b fix: 可用課程名稱搜尋(#3)
$emit is from ChooseDepartment.
2020-09-25 21:16:06 +08:00

37 lines
978 B
Vue

var chooseDepartment = {
props: ['departments', 'selected'],
data: function(){
return {
initSelect: this.selected,
initFounded: "",
}
},
watch: {
'selected': function(){
this.initSelect = this.selected
},
'initSelect': function(){
this.$emit("selectok", this.initSelect)
},
'initFounded': function(){
this.$emit("foundedok", this.initFounded)
}
},
template: `
<div>
<h5>1. 「課程名稱」直接搜尋</h5>
<input class="form-control" type='text' v-model='initFounded'>
<br>或<br><br>
<h5>1. 選擇類別</h5>
<select class="custom-select mr-sm-2" v-model="initSelect">
<option v-for="(item, index) in departments" :key="index"
v-bind:value="item"
>
{{ item }}
</option>
</select>
</div>
`,
}