我用我的選擇選項的應用VUE JS input..I需要設置默認值應在下拉選擇下來,而在變化我想打電話給兩個功能..VUE JS如何設置選項值選擇
我是新來的Vue JS ..
我的代碼:
var listingVue = new Vue({
el: '#mountain',
data:{
formVariables: {
country_id: '',
mountain_id: '',
peak_id: ''
},
countrylist:[],
mountainlist:[],
},
ready: function() {
var datas = this.formVariables;
this.getCountry();
},
methods: {
getCountry: function()
{
this.$http.get(baseurl+'/api/v1/device/getCountry',function(response)
{
this.$set('countrylist',response.result);
//alert(jQuery('#country_id').val());
});
},
getMountain: function(country_id)
{
var datas = this.formVariables;
datas.$set('country_id', jQuery('#country_id').val());
postparemeters = {country_id:datas.country_id};
this.$http.post(baseurl+'/api/v1/site/getMountain',postparemeters,function(response)
{
if(response.result)
this.$set('mountainlist',response.result);
else
this.$set('mountainlist','');
});
},
});
<select
class="breadcrumb_mountain_property"
id="country_id"
v-model="formVariables.country_id"
v-on="change:getMountain(formVariables.country_id);">
<option
v-repeat = "country: countrylist"
value="@{{country.id}}" >
@{{country.name}}
</option>
</select>
要選擇一個?從'重複的國家'? –
查看一些Vue公司的選擇信息[Vuejs選擇DOC(http://vuejs.org/guide/forms.html#Select) –