vue获取select选中的的值
电脑版发表于:2021/11/27 11:44
select中加一个v-model即可
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script> <script src="~/Scripts/jquery-3.3.1.min.js"></script> <div id="pro_citys"> 省:<select id="provice" v-on:change="getCitys" v-model="selected"> <option v-for="item in provices" :value="item.Id">{{item.ProviceName}}</option> </select> </div> <script> var vm = new Vue({ el: "#pro_citys", data: { selected: "1", provices: [], } }); $.get('/vue/GetProvice', function (result) { vm.$data.provices = result; //初始化select选中的值为数据中的第一个 vm.$data.selected = vm.$data.provices[0].Id; }) </script>