html
<el-dialog :title="showTitle" :visible="showDialog" @close="close"> </el-dialog>
使用计算属性
javascript
computed: {
showTitle() {
//这里根据点击的是否有具体点击的那个id来判断
return this.form.id ? "编辑部门" : "新增部门";
},
},
![](https://file.jishuzhan.net/article/1726416168434012162/bc2021f16b66370f5e240fa2cee9ddba.webp)