js常用插件(十五)之基于vue的城市选择插件cityChoice.js

js常用插件(十五)之基于vue的城市选择插件cityChoice.js

欢迎点击: 个人官网博客

效果图:
在这里插入图片描述
cityChoice.js
Animate.css
style.css(cityChoice.css)

使用方法(非常简单):

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<link rel="stylesheet" href="css/Animate.css">
<link rel="stylesheet" href="https://www.jq22.com/jquery/font-awesome.4.6.0.css">
<link rel="stylesheet" href="css/style.css">
<script src="https://www.jq22.com/jquery/vue.min.js"></script>
<script src="cityChoice.js"></script>
<title>城市选择</title>
<!--[if lt IE 9]>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js"></script>
<![endif]-->
</head>
<body>
<section class="adminBox">
<div class="cityChoice">
<h3>点击输入框选择内容</h3>
<input type="text" class="cityInput" v-model.trim='cityInputVal' v-on:click='cityPatFun' />
</div>
<com-citychoice ref="city" v-on:tochildevent='cityjs'></com-citychoice>
</section>
<script>
  new Vue({
    
    
    el:'.adminBox',
    data:{
    
    
      cityInputVal:'',
    },
    methods:{
    
    
      cityPatFun:function(){
    
    
        this.$refs.city.cityFun();
      },
      cityjs:function(data){
    
    
        this.cityInputVal=data;
      }
    }
  })
</script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq_41560520/article/details/114586946