diff --git a/packages/uni-cli-shared/lib/nvue.css b/packages/uni-cli-shared/lib/nvue.css index 57cd934c499cfbc9ec6c6e30e2bcfcdea715dbbe..b0e67664d45a85f785ad4849a8b7668195626fef 100644 --- a/packages/uni-cli-shared/lib/nvue.css +++ b/packages/uni-cli-shared/lib/nvue.css @@ -1,31 +1 @@ -view, -label, -swiper-item, -scroll-view { - display: flex; - flex-direction: column; - flex-shrink: 0; - flex-grow: 0; - flex-basis: auto; - align-items: stretch; - align-content: flex-start; -} -view, -image, -input, -scroll-view, -swiper, -swiper-item, -text, -textarea, -video { - position: relative; - border: 0px solid #000000; - box-sizing: border-box; -} -swiper-item { - position: absolute; -} -button { - margin: 0; -} +label,scroll-view,swiper-item,view{display:flex;flex-direction:column;flex-shrink:0;flex-grow:0;flex-basis:auto;align-items:stretch;align-content:flex-start}image,input,scroll-view,swiper,swiper-item,text,textarea,video,view{position:relative;border:0 solid #000;box-sizing:border-box}swiper-item{position:absolute}button{margin:0} \ No newline at end of file diff --git a/packages/uni-mp-compiler/__tests__/scope.spec.ts b/packages/uni-mp-compiler/__tests__/scope.spec.ts index 7fe5343de7473ce1b714f1a3edfc92ada6fc59bb..8cf56b7fe21f34f279cb72c7d77f64452289fa40 100644 --- a/packages/uni-mp-compiler/__tests__/scope.spec.ts +++ b/packages/uni-mp-compiler/__tests__/scope.spec.ts @@ -38,7 +38,7 @@ describe('compiler: scope', () => { ``, ``, `(_ctx, _cache) => { - return { a: _vFor(_ctx.items, (item, k0, i0) => { return { ...(true ? { a: _ctx.id } : {}) }; }) } + return { a: _vFor(_ctx.items, (item, k0, i0) => { return true ? { a: _ctx.id } : {}; }) } }` ) }) @@ -47,7 +47,7 @@ describe('compiler: scope', () => { `{{ok}}{{ok1}}{{ok2}}{{ok3}}`, `{{b}}{{d}}{{f}}{{g}}`, `(_ctx, _cache) => { - return { a: _ctx.ok, ...(_ctx.ok ? { b: _toDisplayString(_ctx.ok) } : _ctx.ok1 ? { d: _toDisplayString(_ctx.ok1) } : _ctx.ok2 ? { f: _toDisplayString(_ctx.ok2) } : { g: _toDisplayString(_ctx.ok3) }), c: _ctx.ok1, e: _ctx.ok2 } + return _extend({ a: _ctx.ok }, _ctx.ok ? { b: _toDisplayString(_ctx.ok) } : _ctx.ok1 ? { d: _toDisplayString(_ctx.ok1) } : _ctx.ok2 ? { f: _toDisplayString(_ctx.ok2) } : { g: _toDisplayString(_ctx.ok3) }, { c: _ctx.ok1, e: _ctx.ok2 }) }` ) }) @@ -56,7 +56,7 @@ describe('compiler: scope', () => { ``, ``, `(_ctx, _cache) => { - return { a: _ctx.ok, ...(_ctx.ok ? { b: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), c: _ctx.foo, d: _vOn(_ctx.onClick) } : _ctx.ok1 ? { f: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), g: _ctx.foo, h: _vOn(_ctx.onClick) } : { i: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), j: _ctx.foo, k: _vOn(_ctx.onClick) }), e: _ctx.ok1 } + return _extend({ a: _ctx.ok }, _ctx.ok ? { b: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), c: _ctx.foo, d: _vOn(_ctx.onClick) } : _ctx.ok1 ? { f: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), g: _ctx.foo, h: _vOn(_ctx.onClick) } : { i: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), j: _ctx.foo, k: _vOn(_ctx.onClick) }, { e: _ctx.ok1 }) }` ) }) diff --git a/packages/uni-mp-compiler/__tests__/test.spec.ts b/packages/uni-mp-compiler/__tests__/test.spec.ts index c4813a75a2b841531c4635dde0d1ecfdb44147f6..05752244c5126fde21cfa6c996bc4c9c24246cdd 100644 --- a/packages/uni-mp-compiler/__tests__/test.spec.ts +++ b/packages/uni-mp-compiler/__tests__/test.spec.ts @@ -37,11 +37,14 @@ function assert( describe('compiler', () => { test('scope', () => { assert( - ``, - ``, + ``, + `{{b}}`, `(_ctx, _cache) => { - return { a: _ctx.isRed ? 1 : 0 } -}` + return { a: _vFor(_ctx.items, (item, k0, i0) => { return _ctx.ok ? {} : {}; }), b: _ctx.ok } +}`, + { + renderDataSpread: false, + } ) }) }) diff --git a/packages/uni-mp-compiler/__tests__/vFor.spec.ts b/packages/uni-mp-compiler/__tests__/vFor.spec.ts index 9e226c073503608fd1b723f353cedcc1e21d4f56..e52be1b6d09a2bb21f2fcc63f443ba54f6fd414b 100644 --- a/packages/uni-mp-compiler/__tests__/vFor.spec.ts +++ b/packages/uni-mp-compiler/__tests__/vFor.spec.ts @@ -201,7 +201,7 @@ describe(`compiler: v-for`, () => { ``, ``, `(_ctx, _cache) => { - return { a: _ctx.ok, ...(_ctx.ok ? { b: _vFor(_ctx.list, (i, k0, i0) => { return {}; }) } : {}) } + return _extend({ a: _ctx.ok }, _ctx.ok ? { b: _vFor(_ctx.list, (i, k0, i0) => { return {}; }) } : {}) }` ) }) @@ -211,7 +211,7 @@ describe(`compiler: v-for`, () => { `