• vue day3 bootstrap 联动下拉


     <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Page Title</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
    
        <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" />
    
        <script type="text/javascript" src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
    
        <script src="https://unpkg.com/vue@2.5.17/dist/vue.js"></script>
        <style type="text/css">
            .conditions * {
                display: inline;
                 200px;
                margin-left: 150 px;
                margin-top: 20px;
                margin-bottom: 2px;
            }
        
            .btn-default {
                 120px;
                margin-left: 5px;
                margin-top: 5px;
                margin-bottom: 10px;
            }
        
            .dropdown-toggle {
                 30px;
            }
        </style>
    </head>
    <body>
            <body>
    
                    <div id="divContent"  class="conditions" style="height:auto" >
                        <select v-model="OneData" class="form-control">
                            <template v-for="item in selOneVal">
                                    <option v-bind:value="item.value">{{item.text}}</option>
                            </template>
                        </select>
                        <select v-model="TwoData" class="form-control">
                            <template v-for="item in selTwoVal">
                                    <option v-bind:value="item.value">{{item.text}}</option>
                            </template>
                        </select>
                   
                    </div>
                  </body>
    </body>
    
     
        
        <script type="text/javascript">
            $(function () {
                vm.OneChange();
            })
            var vm = new Vue({
                el: '#divContent',
                data: {
                    selOneVal: [],
                    selTwoVal: [],
                    selThreeVal: [],
                    OneData: '国家',
                    TwoData: '',
    
                }, methods: {
                    OneChange: function () {
                        vm.selOneVal = [];
                        this.selOneVal.push(
                            { value: '国家', text: '国家' },
                            { value: '1', text: '中国' },
                            { value: '2', text: '法国' },
                        )
                        this.selTwoVal.push({ value: '省级', text: '省级' })
                    }
                }
                   , watch: {
                       OneData: function () {
                           vm.selTwoVal = [];
                           vm.selThreeVal = [];
                           this.selTwoVal.push({ value: '省级', text: '省级' })
    
                           var s1 = vm.OneData;
                           if (s1 == 1) {
                               this.selTwoVal.push(
                           { value: '1', text: '湖南' },
                           { value: '2', text: '湖北' },
                           { value: '3', text: '上海' })
    
                           } else if (s1 == 2) {
                               this.selTwoVal.push(
                        { value: '4', text: 'Paris' },
                        { value: '5', text: 'Nanc' },
                        { value: '6', text: 'Rouen' })
                           } 
                           vm.TwoData = '省级';
                       },
                   }
            })
        </script>
    
    </html>
    

      

  • 相关阅读:
    改造我们的学习:有钱不会花,抱着金库抓瞎
    (转)我奋斗了18年才和你坐在一起喝咖啡
    初学者要知道的十件事
    [转]C#图像处理 (各种旋转、改变大小、柔化、锐化、雾化、底片、浮雕、黑白、滤镜效果)
    C#调用系统的复制、移动、删除文件对话框
    SQLite数据类型
    jquery禁用dropdownlist中某一项
    C# winform无标题窗体随意移动
    注册.NET Framework
    jQuery同步/异步调用后台方法
  • 原文地址:https://www.cnblogs.com/LiuFengH/p/10469845.html
Copyright © 2020-2023  润新知