From b4aa9e49aa70ab2f390f7f96af314bb17677d97c Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Tue, 10 Mar 2020 12:54:03 +0800 Subject: [PATCH] feat(qa): add Fake Vue --- build/build.qa.js | 34 +++++++++---------- .../uni-quickapp/components/button/button.vue | 2 +- packages/uni-quickapp/dist/vue.dev.js | 3 +- packages/uni-quickapp/dist/vue.prod.js | 3 +- .../uni-quickapp/lib/configure-webpack.js | 3 ++ .../uni-quickapp/lib/loader/app-loader.js | 5 +++ src/platforms/quickapp/runtime/page.js | 17 +++++++++- .../quickapp/service/framework/vue.js | 25 ++++++++++++++ src/platforms/quickapp/service/index.js | 5 ++- .../view/components/button/button.vue | 2 +- 10 files changed, 76 insertions(+), 23 deletions(-) create mode 100644 packages/uni-quickapp/lib/loader/app-loader.js create mode 100644 src/platforms/quickapp/service/framework/vue.js diff --git a/build/build.qa.js b/build/build.qa.js index 9ff1d5117..b4ac950c8 100644 --- a/build/build.qa.js +++ b/build/build.qa.js @@ -36,31 +36,31 @@ dsl.onInitApp(function({ });` }) const appCode = appOutput[0].code - // const pageBundle = await rollup.rollup(genConfig('page')) - // const { - // output: pageOutput - // } = await pageBundle.generate({ - // format: 'iife', - // banner: ` - // dsl.onInitPage(function({ - // $app_require$, - // Vue - // }) { - // `, - // footer: ` - // });` - // }) - // const pageCode = pageOutput[0].code + const pageBundle = await rollup.rollup(genConfig('page')) + const { + output: pageOutput + } = await pageBundle.generate({ + format: 'iife', + banner: ` + dsl.onInitPage(function({ + $app_require$, + Vue + }) { + `, + footer: ` + });` + }) + const pageCode = pageOutput[0].code const vueCode = fs.readFileSync(path.resolve(__dirname, '../packages/uni-quickapp/assets/' + filename)) fs.writeFileSync( path.resolve(__dirname, '../packages/uni-quickapp/dist/' + filename), - vueCode + bridgeCode + appCode, { + vueCode + bridgeCode + appCode + pageCode, { encoding: 'utf8' } ) - if (process.env.NODE_ENV === 'production') { // 命令会执行dev,prod两次,仅prod时执行copy + if (process.env.NODE_ENV === 'production') { // 命令会执行dev,prod两次,仅prod时执行copy const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp/view/components/**/*') const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp/components') diff --git a/packages/uni-quickapp/components/button/button.vue b/packages/uni-quickapp/components/button/button.vue index 9ae2cd5cc..1c8839914 100644 --- a/packages/uni-quickapp/components/button/button.vue +++ b/packages/uni-quickapp/components/button/button.vue @@ -1,5 +1,5 @@