rowe / yii2-region
Yii2中国省市区三级联动
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Language:JavaScript
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-06-05 01:58:52 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]);?>