area
省市区县乡镇街道
- 提供在线和本地JSON获取数据2种方式
- 双向数据绑定,级联选择国内所有省市区县乡镇街道
基础用法
可以传入v-model值回显
<template>
<div class="content-wrap">
<adv-area v-model="areaVal"></adv-area> {{ areaVal }}
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
const areaVal = ref("110107");
</script>
<style scoped></style>会调用接口实时懒加载数据,数据可以精确到街道乡镇
<template>
<div class="content-wrap">
<adv-area remote v-model="areaVal"></adv-area> {{ areaVal }}
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
const areaVal = ref();
</script>
<style scoped></style>模型接口
ts
interface PropI {
modelValue?: string | (string | number)[];
placeholder?: string;
emitPath?: boolean;
}属性
| 属性 | 值 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| v-model | string | (string | number)[] | 否 | default | 双向绑定值 |
| placeholder | string | 否 | 请选择 | 原生placeholder |
| emitPath | Boolean | 否 | false | model是否展示全路径 |
插槽
| 插槽名 | 是否必填 | 默认值 | 说明 |
|---|