第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

按鈕在懸停時(shí)變得透明

按鈕在懸停時(shí)變得透明

猛跑小豬 2022-12-09 19:04:06
我的按鈕組件看起來(lái)像這樣并且工作正常:<Buttoncomponent={Link}to={link}style={{  background: '#6c74cc',  borderRadius: 3,  border: 0,  color: 'white',  height: 48,  padding: '0 30px',  width: 200,}}//className={classes.button}>{text}</Button>但是,現(xiàn)在我正試圖從內(nèi)聯(lián)樣式轉(zhuǎn)移到這個(gè):export const useStyles = makeStyles(() =>  createStyles({    button: {      background: '#6c74cc',        borderRadius: 3,        border: 0,        color: 'white',        height: 48,        padding: '0 30px',         width: 200,            },  }),);現(xiàn)在,當(dāng)我將鼠標(biāo)懸停在我的按鈕上時(shí),它會(huì)變得透明/半透明。盡管樣式與以前相同。我怎樣才能阻止這個(gè)?
查看完整描述

2 回答

?
慕少森

TA貢獻(xiàn)2019條經(jīng)驗(yàn) 獲得超9個(gè)贊

使用makeStyles和createStyles覆蓋所需組件的主題,例如 a等Button。Text


您可以通過(guò)覆蓋root組件的 來(lái)安全地執(zhí)行此操作。否則該按鈕將保留默認(rèn)root主題并與您的樣式發(fā)生沖突。在您的情況下,這將是懸停效果。


像以前一樣使用內(nèi)聯(lián)樣式等同于以下兩個(gè)示例。您將使用哪一個(gè)由您決定,但第一個(gè)覆蓋root,第二個(gè)使用該對(duì)象實(shí)現(xiàn)自定義hover效果:classes.button


const useStyles = makeStyles(createStyles({

    root: {

      background: "#6c74cc",

      borderRadius: 3,

      border: 0,

      color: "white",

      height: 48,

      padding: "0 30px",

      width: 200

    }

  })

);


export default function StackOverflowDemo() {

  const classes = useStyles();


  return <Button className={classes.root}>Hello Sandbox!</Button>;

}

作為替代解決方案,您可以自己在“按鈕”對(duì)象中添加懸停效果,如下所示:


const useStyles = makeStyles(() =>

  createStyles({

    button: {

      background: "#6c74cc",

      borderRadius: 3,

      border: 0,

      color: "white",

      height: 48,

      padding: "0 30px",

      width: 200,

      "&:hover": {

        background: "red", // <- add here your desired color, for demonstration purposes I chose red

      }

    }

  })

);


export default function StackOverflowDemo() {

  const classes = useStyles();


  return <Button className={classes.button}>Hello Sandbox!</Button>;

}



查看完整回答
反對(duì) 回復(fù) 2022-12-09
?
慕森卡

TA貢獻(xiàn)1806條經(jīng)驗(yàn) 獲得超8個(gè)贊

檢查它來(lái)自哪里的開(kāi)發(fā)工具。我假設(shè)它的默認(rèn)樣式。如果是這樣 - 你所要做的就是用你想要的風(fēng)格覆蓋它。在你的情況下 - 如果你不想在懸停期間發(fā)生任何事情,請(qǐng)?zhí)砑尤缦聝?nèi)容:


button:hover {

      background: '#6c74cc',

}

或嵌套


button: {

//...

"&:hover" {

background: '#6c74cc',

}

}


查看完整回答
反對(duì) 回復(fù) 2022-12-09
  • 2 回答
  • 0 關(guān)注
  • 103 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)