城市选择器

省市区城市选择

效果预览

yml配置

- model: city_picker
  label: 城市选择
  url: '/region/region/get_children'
  col_class: 'col-sm-12'
  readonly: '{%isOnly%}'
  append_data: true
  validate:
    required: required
  data:
    - {name: province,placeholder: 请选择省份,value: 2}
    - {name: city,placeholder: 请选择城市,value: 3}
    - {name: area,placeholder: 请选择区,value: 4}

字段说明

city_picker

字段 类型 含义 默认值
model String 该控件类型为city_picker -
label String 控件label名称 -
data Array 省市区配置项,可选配几个 -
placeholder String 占位提示 -
col_class String 控件样式class -
readonly Boolean 是否只读,true为只读 flase
append_data Boolean 是否同时传递选择项名称 flase
validate Object 校验规则,配置参考输入框-validate -
url String 获取省市区数据异步接口 -

city_picker.data

字段 类型 含义 默认值
name String 名称 -
placeholder String 占位提示 -
value String 选中值 -

url返回值结构示例

{
    "ret": 0,
    "msg": "OK",
    "errorcode": 0,
    "data": [{
        "id": "2",
        "parent_id": "1",
        "is_code": "340000",
        "name": "安徽",
        "short_name": "皖",
        "first_letter": "A",
        "type": "1",
        "omg_id": "0",
        "omg_pid": "0"
    }, {
        "id": "3",
        "parent_id": "1",
        "is_code": "820000",
        "name": "澳门",
        "short_name": "",
        "first_letter": "A",
        "type": "1",
        "omg_id": "0",
        "omg_pid": "0"
    }, {
        "id": "4",
        "parent_id": "1",
        "is_code": "110000",
        "name": "北京",
        "short_name": "京",
        "first_letter": "B",
        "type": "1",
        "omg_id": "0",
        "omg_pid": "0"
    }, {
        "id": "6",
        "parent_id": "1",
        "is_code": "350000",
        "name": "福建",
        "short_name": "闽",
        "first_letter": "F",
        "type": "1",
        "omg_id": "0",
        "omg_pid": "0"
    }]
}

results matching ""

    No results matching ""