想在后台的全局表单内容列表里,操作选项里加一个右侧链接按钮,参考了
https://www.xunruicms.com/doc/1232.html
https://www.xunruicms.com/doc/1352.html
我的代码是这样的
// 数据列表
public function index() {
$tpl = $this->_Admin_List(true);
$this->mytable = [
'foot_tpl' => '', // 底部按钮字符串
'link_tpl' => '', // 右侧侧链接字符串
'link_var' => 'html = html.replace(/\{id\}/g, row.id);', // 侧链接的js变量替换,例如{id}表示id
];
// 侧链接,加一个a标签链接
$this->mytable['link_tpl'].= '<label><a href="'.dr_url(APP_DIR.'/customer/show').'&id={id}" class="btn btn-xs blue"> <i class="fa fa-user"></i> 测试</a></label>';
\Phpcmf\Service::V()->assign([
'mytable' => $this->mytable,
]);
return \Phpcmf\Service::V()->display($tpl);
}为什么只剩下侧链接一个按钮了?没加侧链接代码之前数据列表正常显示的。

// 数据列表 public function index() { $tpl = $this->_Admin_List(true); // 侧链接,加一个a标签链接 $this->mytable['link_tpl'].= '<label><a href="'.dr_url(APP_DIR.'/customer/show').'&id={id}" class="btn btn-xs blue"> <i class="fa fa-user"></i> 测试</a></label>'; \Phpcmf\Service::V()->assign([ 'mytable' => $this->mytable, ]); return \Phpcmf\Service::V()->display($tpl); }// 数据列表 public function index() { $tpl = $this->_Admin_List(true); $this->mytable = \Phpcmf\Service::V()->get_value("mytable"); // 侧链接,加一个a标签链接 $this->mytable['link_tpl'].= '<label><a href="'.dr_url(APP_DIR.'/customer/show').'&id={id}" class="btn btn-xs blue"> <i class="fa fa-user"></i> 测试</a></label>'; \Phpcmf\Service::V()->assign([ 'mytable' => $this->mytable, ]); return \Phpcmf\Service::V()->display($tpl); }