文章目录
style中变量作为属性值
<a-button
style="width: 100%; margin-top: 16px; margin-bottom: 8px"
type="dashed"
icon="plus"
@click="XianShiXiangQing"
>显示审批详情
</a-button>
<div :style="a">
<a-descriptions
bordered
:column="{ xxl: 3, xl: 3, lg: 3, md: 3, sm: 1, xs: 1 }"
style="text-align: right"
>
<a-descriptions-item label="部门负责人意见" :span="3">
<a-textarea
v-model="form.opinionDepartment"
style="background-color: white; color: black; border: 0"
:auto-size="{ minRows: 4 }"
placeholder="填写部门负责人意见"
disabled
/>
<a-row>
<a-col :span="9"></a-col>
<a-col :span="9">签名:</a-col>
<a-col :span="6">日期:{{ form.timeDepartment }}</a-col>
</a-row>
</a-descriptions-item>
</div>
return{
a:"display:none",
}
methods:{
XianShiXiangQing(){
this.a="display:block";
},
}
分析
当style中有变量,则写为: :style=a,其中a为变量。必须加冒号
当style中没有变量,一般写法就行:style=“margin-left: 30px; width: 180px"或
style=”{margin-left: 30px; width: 180px}"