yii\grid\ActionColumn buttons 操作更改请求路由 $url [ 技术分享 ]
正常编辑 template 更改$url 会由当前域名路由更改为所写路由如:/shop-goods-class/index
框架携带参数为 id 生成操作 shop-goods-class/index?id=XX
['class' => 'yii\grid\ActionColumn','header'=>'操作','template' => '{/shop-goods-class/index} {view} {update} {delete}',
'buttons' => [
'/shop-goods-class/index' => function ($url, $model, $key) {
return Html::a('<span class="glyphicon glyphicon-plusm">产品管理</span>', $url, ['title' => '产品管理'] ) ;
},
],
],
如想把 shop-goods-class/index?id=XX
变为 shop-goods-class/index?xx=XX
或者 shop-goods-class/index?xx=XX&xx=xx
['class' => 'yii\grid\ActionColumn','header'=>'操作','template' => '{/shop-goods-class/index} {view} {update} {delete}',
'buttons' => [
'/shop-goods-class/index' => function ($url, $model, $key) {
$url = "/shop-goods-class/index?shop_id=$model->id";
return Html::a('<span class="glyphicon glyphicon-plusm">产品管理</span>', $url, ['title' => '产品管理'] ) ;
},
],
],
共 1 条回复
唯_爱
注册时间:2017-03-14
最后登录:2022-03-30
在线时长:9小时0分
最后登录:2022-03-30
在线时长:9小时0分
- 粉丝2
- 金钱70
- 威望0
- 积分160