rowe / yii2-region
Yii2中国省市区三级联动
Package info
Language:JavaScript
Type:yii2-extension
pkg:composer/rowe/yii2-region
v1.0
2017-08-03 05:32 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2026-02-25 10:23:28 UTC
README
This is an Yii2 widget for Chinese region list field. (https://github.com/rowe/yii2-region)
Demo
Installation
Add to composer.json file with:
"rowe/yii2-region": "dev-master"
Configuration
Copy the @rowe/yii2-region/src/migrations/m170621_032947_region.php to the migration folder like console/migrations. Run
"Yii migrate"
The region codes would be inserted via Yii migration
Usage
Firstly, bind the behavior to your model which need to use the region fields.
public function behaviors() { return [ 'RegionBehavior' => [ 'class' => RegionBehavior::className(), ] ]; }
And then, use the widget in the view.
<?= RegionWidget::widget(['model' => $model]);?>
