render: (h, params) => { let titleStr = "发布任务"; if (params.row.tasktype == "项目任务") { titleStr = "指定流程模板"; } var settingBtn = h( "Button", { props: { type: "info", size: "small", disabled: params.row.tasktype == "项目任务" && Number(params.row.status) > 1, }, attrs: { title: titleStr, }, style: { marginRight: "2px", border: "none", color: params.row.tasktype == "项目任务" && Number(params.row.status) > 1 ? "" : "#1884FF", background: "none", }, on: { click: () => { this.showProjectSettings(params); }, }, }, "配置" //'接受' )里的on改成vue3模式的跳转页面
时间: 2024-01-12 12:02:35 浏览: 34
在Vue 3中,跳转页面的方式有所变化。你可以使用`router.push`方法来实现页面跳转。具体地,你需要先在组件的`setup`函数中导入`router`,然后在`click`事件处理函数中调用`router.push`方法来跳转页面。下面是一个示例代码:
```
import { useRouter } from 'vue-router';
export default {
setup() {
const router = useRouter();
const showProjectSettings = (params) => {
// 在这里调用router.push来实现页面跳转
router.push('/project-settings');
};
return {
showProjectSettings,
};
},
render(h, params) {
let titleStr = "发布任务";
if (params.row.tasktype == "项目任务") {
titleStr = "指定流程模板";
}
const settingBtn = h(
"Button",
{
props: {
type: "info",
size: "small",
disabled:
params.row.tasktype == "项目任务" &&
Number(params.row.status) > 1,
},
attrs: {
title: titleStr,
},
style: {
marginRight: "2px",
border: "none",
color:
params.row.tasktype == "项目任务" &&
Number(params.row.status) > 1
? ""
: "#1884FF",
background: "none",
},
on: {
click: () => {
this.showProjectSettings(params);
},
},
},
"配置"
);
// ...
},
}
```
在上面的代码中,我们先使用`useRouter`导入了`router`,然后在`showProjectSettings`函数中使用了`router.push`方法来跳转页面。在`render`函数中,我们调用`showProjectSettings`函数来响应`click`事件。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)