<!-- 问卷 --> <template> <div class="maingw" ref="maingwwj" style="height: 100%; overflow: auto"> <el-row :gutter="gutter"> <el-button type="danger" v-if="this.dataitem.CHI_MED_FORM_NO" @click="deletefun" style="position: absolute; left: 20px; top: 10px" > 删除 </el-button> <h3> 中医体质辨识问卷 <el-button size="mini" v-if="this.dataitem.CHI_MED_FORM_NO" round @click="dayinView()" >打印预览</el-button > </h3> </el-row> </template> 一进来页面将页面全部灰置掉,当点击编辑按钮时页面恢复正常
时间: 2024-04-21 08:22:08 浏览: 7
根据你提供的代码,可以使用一个 `isEdit` 变量来控制页面的编辑状态。当 `isEdit` 为 `false` 时,将页面置灰,当点击编辑按钮时,将 `isEdit` 设置为 `true`,页面恢复正常。以下是修改后的代码:
```html
<template>
<div class="maingw" ref="maingwwj" style="height: 100%; overflow: auto">
<el-row :gutter="gutter">
<el-button
type="danger"
v-if="dataitem.CHI_MED_FORM_NO && !isEdit"
@click="deletefun"
style="position: absolute; left: 20px; top: 10px"
>
删除
</el-button>
<h3>
中医体质辨识问卷
<el-button
size="mini"
v-if="dataitem.CHI_MED_FORM_NO && !isEdit"
round
@click="dayinView()"
>打印预览</el-button
>
</h3>
</el-row>
</div>
</template>
<script>
export default {
data() {
return {
isEdit: false,
// other data properties
}
},
methods: {
deletefun() {
// delete function implementation
},
dayinView() {
// print preview function implementation
},
// other methods
}
}
</script>
```
然后在编辑按钮的点击事件中,将 `isEdit` 设置为 `true`:
```html
<el-button type="primary" @click="isEdit = true">编辑</el-button>
```
这样,在没有点击编辑按钮时,页面将会处于置灰状态,点击编辑按钮后,页面将恢复正常。