From 0cbb1730cbb78e2045f0bf03251a816d55cadad3 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Sun, 24 Oct 2021 00:36:51 +0800 Subject: [PATCH] fix(log): `font-size` prop not working, closes #1416 --- CHANGELOG.en-US.md | 4 ++++ CHANGELOG.zh-CN.md | 4 ++++ src/code/src/Code.tsx | 4 +++- src/log/src/Log.tsx | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 97fb0800f..fe9b6f94b 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -4,6 +4,10 @@ - `n-collapsed-transition`'s `collapsed` prop is deprecated, please use `show` instead, closes [#1407](https://github.com/TuSimple/naive-ui/issues/1407). +### Fixes + +- Fix `n-log` `font-size` prop not working, closes [#1416](https://github.com/TuSimple/naive-ui/issues/1416). + ## 2.19.11 (2021-10-21) ### Fixes diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 1bb81c05e..7a5ddc980 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -4,6 +4,10 @@ - `n-collapsed-transition` 的 `collapsed` 属性被废弃,请使用 `show` 属性代替,关闭 [#1407](https://github.com/TuSimple/naive-ui/issues/1407) +### Fixes + +- 修复 `n-log` `font-size` 属性不生效,关闭 [#1416](https://github.com/TuSimple/naive-ui/issues/1416) + ## 2.19.11 (2021-10-21) ### Fixes diff --git a/src/code/src/Code.tsx b/src/code/src/Code.tsx index 0f77b7c0a..d3c3cfb95 100644 --- a/src/code/src/Code.tsx +++ b/src/code/src/Code.tsx @@ -31,6 +31,7 @@ const codeProps = { uri: Boolean, inline: Boolean, // In n-log, we only need to mount code's style for highlight + internalFontSize: Number, internalNoHighlight: Boolean } @@ -117,8 +118,9 @@ export default defineComponent({ 'hue-6-2': $9 } } = themeRef.value + const { internalFontSize } = props return { - '--font-size': fontSize, + '--font-size': internalFontSize ? `${internalFontSize}px` : fontSize, '--font-family': fontFamilyMono, '--font-weight-strong': fontWeightStrong, '--bezier': cubicBezierEaseInOut, diff --git a/src/log/src/Log.tsx b/src/log/src/Log.tsx index a4cfbd72a..cbff1de49 100644 --- a/src/log/src/Log.tsx +++ b/src/log/src/Log.tsx @@ -271,6 +271,7 @@ export default defineComponent({ default: () => (