ichynul/tpextareacity

1.2.5 2024-08-06 05:41 UTC

This package is auto-updated.

Last update: 2024-09-06 06:30:25 UTC


README

安装

方式1:使用 composer 安装

composer require ichynul/tpextareacity

方式2:使用 extend 安装

[tpext.core] 从 1.6.4|3.3.2|4.0.7 版本开始,支持使用 extend 方式在线安装。

  • 数据源 https://github.com/xiangyuecn/AreaCity-JsSpider-StatsGov | https://gitee.com/xiangyuecn/AreaCity-JsSpider-StatsGov

  • 本扩展不会频繁更新数据,如需数据,请自行下载[ok_data_level4.csv]文件导入。

  • [phpmyadmin] 导入方法:选择 [tp_areacity] 表,点击 [操作] 菜单,将数据表复制到(数据库名.数据表名),填写新表名如tp_areacity1 [执行] 备份。

  • [操作] 菜单-清空数据表 (TRUNCATE),清空表数据。

  • [导入] 菜单上传下载的 [ok_data_level4.csv] ,点击 [执行] ,导入后删除第一行表头字段。

DEMO

   $form->fields('省/市/区');
   $form->select('province', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('api/areacity/province'), 'ext_name')->withNext(
            $form->select('city', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('api/areacity/city'), 'ext_name')->withNext(
                $form->select('area', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('api/areacity/area'), 'ext_name')
            )
        );
   $form->fieldsEnd();
   
   //或者
   $form->fields('省/市/区')->with(
       $form->select('province', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('api/areacity/province'), 'ext_name')->withNext(
            $form->select('city', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('api/areacity/city'), 'ext_name')->withNext(
                $form->select('area', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('api/areacity/area'), 'ext_name')
            )
        );
   );