vue动态改变样式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p :style="{color:(type==1?`${WeChat}`:`${Alipay}`)}">xxxx</p>
<van-button :style="{background:(type==1?`${WeChat}`:`${Alipay}`)}">xxxx</van-button>
<script>
export default {
data() {
return {
WeChat: "rgba(69, 193, 102, 1)",
Alipay: "rgba(18,150,219,1)",
}
}
}
</script>
</body>
</html>