Skip to content

Commit

Permalink
fix: reset spacing cannot generate correct source code (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
chilingling authored Sep 3, 2024
1 parent 76c23b7 commit c35c34e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ export default {
properties[name] = {
value,
text: value === 'auto' ? 'auto' : String(Number.parseInt(value || 0)), // 界面 box 中显示的数值
text: value === 'auto' ? 'auto' : String(Number.parseInt(value) || 0), // 界面 box 中显示的数值
setting: Boolean(value) // 属性是否已设置值
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export default {
props.property.value?.indexOf('px') > -1 ? Number.parseInt(props.property.value) : props.property.value
)
const updateStyle = (value) => {
emit('update', { [props.property.name]: value })
}
const sliderChange = () => {
if (sliderFlag) {
updateStyle(`${sliderValue.value}px`)
Expand All @@ -83,11 +87,7 @@ export default {
const reset = () => {
sliderFlag = false
updateStyle('')
}
const updateStyle = (value) => {
emit('update', { [props.property.name]: value })
updateStyle(null)
}
const inputChange = (property) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/settings/styles/src/js/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export const stringify = (originParseList, styleObject, config = {}) => {
if (key.includes('comment')) {
str += `${value.value}\n`
} else {
str += `${key}: ${value.value};\n`
str += `${key}: ${value.value === '' ? "''" : value.value};\n`
}
}
} else {
Expand All @@ -249,7 +249,7 @@ export const stringify = (originParseList, styleObject, config = {}) => {
// 在 styleObject 的,可能有改动,所以需要用 styleObject 拼接
for (const [key, value] of Object.entries(styleObject[item.selectors].rules)) {
if (![null, undefined].includes(value)) {
str += `${key}: ${value};\n`
str += `${key}: ${value === '' ? "''" : value};\n`
}
}
}
Expand All @@ -266,7 +266,7 @@ export const stringify = (originParseList, styleObject, config = {}) => {
str += `${selector} {\n`

for (const [declKey, declValue] of Object.entries(value.rules)) {
str += `${declKey}: ${declValue};\n`
str += `${declKey}: ${declValue === '' ? "''" : declValue};\n`
}

str += '}\n'
Expand Down

0 comments on commit c35c34e

Please sign in to comment.