首页 > 其他 > 详细

vue selected联动查询实例2

时间:2017-03-02 23:25:02      阅读:321      评论:0      收藏:0      [点我收藏+]
<body id="app">
    <select v-model="selected" id="text"> 
        <option v-for="option in options"> {{option.text}} </option>
    </select> 
    <br />
    <br />
    <br />
    <select v-model="list"> 
        <option v-for="v in list">{{v.a}}-{{v.b}} </option>
    </select> 
  </body>

new Vue({
    el: ‘#app‘,
    data: {
       selected:"A",
         options: Array
    },
    ready: function () {
      let option= [
         { text: ‘One‘, value: [{a:1,b:2},{a:2,b:3},{a:3,b:4}] },
         { text: ‘Two‘, value: [{a:11,b:22},{a:22,b:33},{a:33,b:44}] }, 
         { text: ‘Three‘, value: [{a:111,b:222},{a:222,b:333},{a:333,b:444}] } 
       ];
       this.$set("options",option);
         console.log(this.options);
    },
    computed: {
        list: function () {
            for(var i in this.options){
                // console.log(this.options[i].text)
                if(this.options[i].text == this.selected){
                    console.log(this.options[i].value)
                    return this.options[i].value
                }
            }
        }
    }
  })

http://www.cnblogs.com/jasonwang2y60/p/6404352.html 

vue selected联动查询实例2

原文:http://www.cnblogs.com/liadmin/p/6492847.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!