前端Vue专辑VueVUE

vue组件封装 | 多级地址选择器

2016-12-06  本文已影响1525人  小母鸡叽叽叽

基于vue.js的多级联动地址选择器,需要配合element-ui使用

演示3.gif

如何使用?

<template>
  <div id="app">
    <vue-address
        :province="province"
        :city="city"
        :detail="detail"
        @change="handlerChange"
    ></vue-address>
  </div>
</template>

<script>
import vueAddress from './components/address'
export default {
  components: {
    vueAddress
  },
  data: function() {
    return {
        province:'',
        city:'',
        detail:''
    }
  },
  methods: {
    handlerChange: function (val) {
        console.log(val);
    }
  }
}
</script>
<style>
#app {text-align: center;color: #2c3e50;margin-top: 60px;}
</style>

vue-address属性

vue-address事件

上一篇 下一篇

猜你喜欢

热点阅读