PHP code example of super-eggs / dcat-distpicker
1. Go to this page and download the library: Download super-eggs/dcat-distpicker library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
super-eggs / dcat-distpicker example snippets
$form->distpicker(['province_id', 'city_id', 'district_id']);
$form->distpicker([
'province_id' => '省份',
'city_id' => '市',
'district_id' => '区'
], '地域选择')->default([
'province' => 130000,
'city' => 130200,
'district' => 130203,
]);
// 省、市、区
$form->distpicker([
'province_id' => '省',
'city_id' => '市',
'district_id' => '区'
]);
// 省、市 (Available in v2.1.0+)
$form->distpicker([
'province_id' => '省',
'city_id' => '市',
]);
// 只显示省 (Available in v2.1.0+)
$form->distpicker([
'province_id' => '省',
]);
$form->distpicker(['province_id', 'city_id', 'district_id'], '请选择区域');
$form->distpicker(['province_id', 'city_id', 'district_id'])->autoselect(1);
$filter->distpicker('province_id', 'city_id', 'district_id', '地域选择');
// 省、市 (Available in v2.1.0+)
$filter->distpicker('province_id', 'city_id','', '地域选择');
//or
$filter->distpicker('province_id', 'city_id');
// 只显示省 (Available in v2.1.0+)
$filter->distpicker('province_id','','', '地域选择');
//or
$filter->distpicker('province_id');
$grid->column('province_id')->distpicker();
$grid->column('city_id')->distpicker();
$grid->column('district_id')->distpicker();
use SuperEggs\DcatDistpicker\DcatDistpickerHelper;
DcatDistpickerHelper::getAreaName($code); // return string