Skip to content

Commit 16245b1

Browse files
committed
fix(nvue-styler): border 展开逻辑nvue 避免告警
1 parent 1f0a128 commit 16245b1

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

packages/uni-nvue-styler/src/expand/border.ts

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,28 @@ import { transformBorderColor } from './borderColor'
44
import { transformBorderStyle } from './borderStyle'
55
import { transformBorderWidth } from './borderWidth'
66

7-
const borderWidth = (): string => {
8-
if (__NODE_JS__) {
9-
return '-width'
10-
}
11-
return 'Width'
12-
}
13-
const borderStyle = (): string => {
14-
if (__NODE_JS__) {
15-
return '-style'
16-
}
17-
return 'Style'
18-
}
19-
const borderColor = (): string => {
20-
if (__NODE_JS__) {
21-
return '-color'
22-
}
23-
return 'Color'
24-
}
25-
267
export function createTransformBorder(
278
options: NormalizeOptions
289
): TransformDecl {
2910
return (decl: Declaration): Declaration[] => {
11+
const borderWidth = (): string => {
12+
if (__NODE_JS__) {
13+
return '-width'
14+
}
15+
return 'Width'
16+
}
17+
const borderStyle = (): string => {
18+
if (__NODE_JS__) {
19+
return '-style'
20+
}
21+
return 'Style'
22+
}
23+
const borderColor = (): string => {
24+
if (__NODE_JS__) {
25+
return '-color'
26+
}
27+
return 'Color'
28+
}
3029
const { prop, value, important, raws, source } = decl
3130
const splitResult = value.replace(/\s*,\s*/g, ',').split(/\s+/)
3231
const result: Array<string | null> = [
@@ -139,6 +138,10 @@ export function createTransformBorderNvue(
139138
options: NormalizeOptions
140139
): TransformDecl {
141140
return (decl) => {
141+
const borderWidth = __NODE_JS__ ? '-width' : 'Width'
142+
const borderStyle = __NODE_JS__ ? '-style' : 'Style'
143+
const borderColor = __NODE_JS__ ? '-color' : 'Color'
144+
142145
const { prop, value, important, raws, source } = decl
143146
const splitResult = value.replace(/\s*,\s*/g, ',').split(/\s+/)
144147
const result = [
@@ -155,14 +158,14 @@ export function createTransformBorderNvue(
155158
return [
156159
createDecl(
157160
prop + borderWidth,
158-
(result[0] || (options.type === 'uvue' ? 'medium' : '0')).trim(),
161+
(result[0] || '0').trim(),
159162
important,
160163
raws,
161164
source
162165
),
163166
createDecl(
164167
prop + borderStyle,
165-
(result[1] || (options.type === 'uvue' ? 'none' : 'solid')).trim(),
168+
(result[1] || 'solid').trim(),
166169
important,
167170
raws,
168171
source

0 commit comments

Comments
 (0)