diff --git a/packages/vue-cli-plugin-hbuilderx/packages/weex-styler/lib/shorthand-parser.js b/packages/vue-cli-plugin-hbuilderx/packages/weex-styler/lib/shorthand-parser.js index 295476c9fc69c010fa91a386a6b4df34c28e2eae..ddb2ac19bbe2957db55ec81cc9e39eae9f80a194 100644 --- a/packages/vue-cli-plugin-hbuilderx/packages/weex-styler/lib/shorthand-parser.js +++ b/packages/vue-cli-plugin-hbuilderx/packages/weex-styler/lib/shorthand-parser.js @@ -39,7 +39,9 @@ function transition (declaration) { map['transition-delay'].push((match[4] || '0s').trim()) } for (var key in map) { - result.push(generateDeclaration(key, map[key].join(', '), important, position)) + var value = map[key] + value = value.find(item => item !== value[0]) ? value.join(', ') : value[0] + result.push(generateDeclaration(key, value, important, position)) } } return result diff --git a/packages/vue-cli-plugin-hbuilderx/packages/weex-styler/test/shorthand-parser.spec.js b/packages/vue-cli-plugin-hbuilderx/packages/weex-styler/test/shorthand-parser.spec.js index 8f4a13fe330b6246038c17a1b529b5cb1d85e58d..6e7af0a9ee77350d2ab10eeb2efb9aa963b1ebbc 100644 --- a/packages/vue-cli-plugin-hbuilderx/packages/weex-styler/test/shorthand-parser.spec.js +++ b/packages/vue-cli-plugin-hbuilderx/packages/weex-styler/test/shorthand-parser.spec.js @@ -73,6 +73,36 @@ describe('shorthand-parser', function () { value: '0s, 1s, 0s', position: {} }]) + + expect(shorthandParser([{ + type: 'declaration', + property: 'transition', + value: 'width 2s, height 2s', + position: {} + }])).eql([{ + type: 'declaration', + property: 'transition-property', + value: 'width, height', + position: {} + }, + { + type: 'declaration', + property: 'transition-duration', + value: '2s', + position: {} + }, + { + type: 'declaration', + property: 'transition-timing-function', + value: 'ease', + position: {} + }, + { + type: 'declaration', + property: 'transition-delay', + value: '0s', + position: {} + }]) }) it('parse margin', function () {