123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <template>
- <selector-card
- class="area-selector"
- :cardType="selectorType"
- @onConfirm="onConfirm"
- @onCancel="onCancel">
- <div slot="header" :class="{ 's-header': selectorType === 'line' }">
- <slot name="header">选择区域</slot>
- </div>
- <AreaSelectorContent
- ref="content"
- :selectorType="selectorType"
- :showSearchInput="showSearchInput"
- :showSelectResult="showSelectResult"
- :onlyProvince="onlyProvince"
- :singleChoice="singleChoice"
- :initCityMap="initCityMap"
- :beforeTabClick="beforeTabClick"
- :comtype="comtype"
- @onChange="onChange"
- />
- </selector-card>
- </template>
- <script>
- import SelectorCard from '@/components/selector/SelectorCard.vue'
- import AreaSelectorContent from '@/components/selector/AreaSelectorContent.vue'
- export default {
- name: 'area-selector',
- components: {
- SelectorCard,
- AreaSelectorContent
- },
- props: {
- selectorType: {
- type: String,
- default: 'card' // card/line
- },
- // 仅选中省份
- onlyProvince: {
- type: Boolean,
- default: false
- },
- singleChoice: { // 是否单选? 只有在selectorType=line下才会生效
- // type: Boolean,
- default: false
- },
- showSearchInput: { // 是否显示搜索 只有在selectorType=card下才会生效
- type: Boolean,
- default: true
- },
- showSelectResult: { // 是否显示选择结果 只有在selectorType=card下才会生效
- type: Boolean,
- default: false
- },
- beforeTabClick: Function,
- comtype: {
- type: String,
- default: ''
- },
- // 初始化城市数据
- // 刚进入页面需要被选中的城市数据
- initCityMap: {
- type: Object,
- default () {
- return {}
- }
- }
- },
- computed: {
- content () {
- return this.$refs.content
- }
- },
- created () {},
- methods: {
- initList (map = {}) {
- return this.$refs.content.initIndexBarAndAreaMap(map)
- },
- setCitySelected (data) {
- return this.$refs.content.setCitySelected(data)
- },
- getSelectedCity () {
- return this.$refs.content.getSelectedCity()
- },
- onCancel () {
- this.$emit('onCancel')
- },
- onConfirm () {
- const selectedCity = this.getSelectedCity()
- this.$emit('onConfirm', selectedCity)
- },
- onChange (selected) {
- this.$emit('onChange', selected)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|