【发布时间】:2021-12-31 01:56:32
【问题描述】:
我有以下脚本,我希望能够在启用后将按钮颜色从灰色(禁用时)更改为绿色。
我在我的 css 中添加了 disabled 和 enabled 属性,并使用了 vue.js(我是新手),但到目前为止它似乎没有从灰色变为绿色。而是保持浅绿色,然后是绿色。
这是我的脚本
CSS 和 HTML
.disabled {
opacity: 0.4;
background:grey;
}
.
.ctaBtn_Start,
.ctaBtn_Start a:link,
.ctaBtn_Start a:visited {
background: pink;
/* VARIABLE */
text-align: center;
border-radius: 0.625rem;
border: none;
font-size: 1.5rem;
font-weight: 700;
cursor: pointer;
/*vertical-align: middle;*/
color: #ffffff;
margin-bottom: 1.25rem;
padding: 0.5rem 2rem;
vertical-align: auto;
}
.ctaBtn_Start:hover {
background: #00cc00;
/* VARIABLE */
}
.ctaBtn_Start:disabled,
button[disabled] {
background: yellow;
color: #ffffff;
}
.ctaBtn_Start:enabled,
button[enabled] {
background: #049804; // pink; // #006600;
// color: #049804;
}
// and HTML Button with vue.js binding to the css
<button enabled disabled class="ctaBtn_Start"
type="submit"
v-bind:class="{ 'disabled' : $v.$invalid || isLoading }">
Start
</button>
【问题讨论】:
-
请附加当前结果,如果适用,请附加所需结果。