diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index 0c60c8bdf748a27905cc964ac695ef2beb75f92b..11fdf38ae6999545d670abb97455a2f824060a82 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -6226,7 +6226,7 @@ var serviceContext = (function () { let todoNavigator = false; - function navigate(path, callback) { + function navigate (path, callback) { { if (todoNavigator) { return console.error(`已存在待跳转页面${todoNavigator.path},请不要连续多次跳转页面`) @@ -6254,7 +6254,7 @@ var serviceContext = (function () { } } - function todoNavigate() { + function todoNavigate () { if (!todoNavigator) { return } @@ -6268,7 +6268,7 @@ var serviceContext = (function () { return navigate() } - function navigateFinish() { + function navigateFinish () { { // 创建预加载 const preloadWebview = createPreloadWebview(); @@ -6278,9 +6278,9 @@ var serviceContext = (function () { if (todoNavigator.nvue) { return todoNavigate() } - preloadWebview.loaded ? - todoNavigator.navigate() : - registerWebviewReady(preloadWebview.id, todoNavigate); + preloadWebview.loaded + ? todoNavigator.navigate() + : registerWebviewReady(preloadWebview.id, todoNavigate); } } @@ -8859,7 +8859,6 @@ var serviceContext = (function () { 'uni-page-refresh', 'uni-actionsheet', 'uni-modal', - 'uni-picker', 'uni-toast', 'uni-resize-sensor', diff --git a/packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js b/packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js index d4d300cd3122b71925bb9fa5df7551a402b16819..c487472655241a2db941b77b37cd876b874719ed 100644 --- a/packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js +++ b/packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js @@ -190,7 +190,7 @@ describe('codegen', () => { it('generate slot target', () => { assertCodegen( '

hello world

', - `with(this){return _c('p',{attrs:{"slot":"one","_i":0},slot:"one"})}` + `with(this){return _c('p',{attrs:{"_i":0},slot:"one"})}` ) }) @@ -291,7 +291,7 @@ describe('codegen', () => { it('generate static attrs', () => { assertCodegen( '', - `with(this){return _c('input',{attrs:{"name":"field1","_i":0}})}` + `with(this){return _c('input',{attrs:{"_i":0}})}` ) }) @@ -558,14 +558,14 @@ describe('codegen', () => { it('generate component', () => { assertCodegen( '
hi
', - `with(this){return _c('my-component',{attrs:{"name":"mycomponent1","msg":msg,"_i":0},on:{"notify":onNotify}},[_c('div',{attrs:{"_i":1}})])}` + `with(this){return _c('my-component',{attrs:{"msg":msg,"_i":0},on:{"notify":onNotify}},[_c('div',{attrs:{"_i":1}})])}` ) }) it('generate svg component with children', () => { assertCodegen( '', - `with(this){return _c('svg',{attrs:{"_i":0}},[_c('my-comp',{attrs:{"_i":1}},[_c('circle',{attrs:{"r":10,"_i":2}})])],1)}` + `with(this){return _c('svg',{attrs:{"_i":0}},[_c('my-comp',{attrs:{"_i":1}},[_c('circle',{attrs:{"_i":2}})])],1)}` ) }) diff --git a/packages/uni-template-compiler/__tests__/demo.js b/packages/uni-template-compiler/__tests__/demo.js index b28e165439e84a13c433fae5b42732c7b2765722..d83baf8038dde0017e707b41b85a6d95a05dff65 100644 --- a/packages/uni-template-compiler/__tests__/demo.js +++ b/packages/uni-template-compiler/__tests__/demo.js @@ -2,15 +2,15 @@ const compiler = require('../lib') const res = compiler.compile( ` - + `, { resourcePath: '/User/fxy/Documents/test.wxml', mp: { platform: 'app-plus' }, - // service: true - view: true + service: true + // view: true }) console.log(require('util').inspect(res, { colors: true, diff --git a/packages/uni-template-compiler/lib/app/service.js b/packages/uni-template-compiler/lib/app/service.js index 93def304a4bc623910a3bd988843326f589fb299..fcc057d43899a942fdaaacfbc0ac28417876cde6 100644 --- a/packages/uni-template-compiler/lib/app/service.js +++ b/packages/uni-template-compiler/lib/app/service.js @@ -21,7 +21,6 @@ function genData (el) { dynamicTexts, directivesBinding } = el - let extras = '' if (directivesBinding) { @@ -265,12 +264,17 @@ function processText (el) { } } +function processAttrs (el) { + el.attrs = el.attrs.filter(attr => attr.name === ID || isVar(attr.value)) +} + function postTransformNode (el) { parseEvent(el) removeStatic(el) renameBinding(el) + processAttrs(el) processText(el) updateForEleId(el)