forked from opentiny/tiny-engine
fix: reset spacing cannot generate correct source code (#657)
This commit is contained in:
parent
76c23b767b
commit
c35c34e036
|
@ -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) // 属性是否已设置值
|
||||
}
|
||||
})
|
||||
|
|
|
@ -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`)
|
||||
|
@ -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) => {
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue