<template slot-scope="scope">
<span :style="{color: scope.row.useFlag === 'Y' ? '#289C38' : '#F04646'}">
<el-button :style="{width: buttonWidth}"></el-button>
</template>
比如:当判断当前界面是英文模式下,width是90px,中文模式下,width是80px;
<script>
computed: {
buttonWidth: function() {
return getLang() == 'zh_CN' ? 80 + 'px' : 90 + 'px';
}
}
</script>
getLang()方法:
公司项目的中英文模式可以从cookie中获取,
export function getLang() {
return cookie.get('Language') || 'zh_CN'
}