zoukankan      html  css  js  c++  java
  • 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>
    

      

  • 相关阅读:
    端口
    IDEA 快捷建
    Correct the classpath of your application so that it contains a single, compatible version of javax.
    Consider renaming one of the beans or enabling overriding by setting
    Idea 关于SpringBoot的@AutoWired 注入问题--无法自动装配Could not autowire. No beans of 'UserMapper' type found. more...
    数据库相关问题
    Initialization failed for 'https://start.spring.io' Please check URL, network and proxy settings. E
    爬虫
    CMS总结
    rust 打印当前时间
  • 原文地址:https://www.cnblogs.com/LiuFengH/p/10469845.html
Copyright © 2011-2022 走看看