Svelte中仅为Jeju Myeongjo字体设置不同字号的实现方法
实现方案
直接调整字号类的条件判断逻辑,让text-5xl和text-2xl根据字体类型与large状态分别生效:
<span class:font-codystar={fontFamily === "codystar"} class:font-cormorant={fontFamily === "cormorant"} class:font-waterfall={fontFamily === "waterfall"} class:font-jeju-myeongjo={fontFamily === "jejuMyeongjo"} class:text-5xl={large && fontFamily !== "jejuMyeongjo"} class:text-2xl={large && fontFamily === "jejuMyeongjo"} class:text-typography-light={theme === "light"} class:text-typography-dark={theme === "dark"} >
逻辑说明
- 当
large为true且字体不是Jeju Myeongjo时,应用text-5xl - 当
large为true且字体是Jeju Myeongjo时,应用text-2xl - 若
large为false,两个字号类都不会被添加
内容的提问来源于stack exchange,提问作者Kiju Shin
相关产品推荐
相关产品推荐

