提交 b4aa9e49 编写于 作者: fxy060608's avatar fxy060608

feat(qa): add Fake Vue

上级 1696e664
......@@ -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')
......
<template>
<div v-on="$listener">
<div v-on="$listeners">
<text>
<slot />
</text>
......
......@@ -43,6 +43,9 @@ module.exports = {
entry() {
return process.UNI_ENTRY
},
externals: {
vue: 'Vue'
},
plugins: [
new webpack.DefinePlugin({
// 平台:na
......
//import uni-pages
//解析main.js中全局组件?
module.exports = function(source, map) {
}
// 快应用vue组件样式需要被合并到独立的css.json中,目前采用easycom实时编译
/* eslint-disable no-undef */
if (typeof __VueOptions !== 'undefined') {
// 将 main.js 中的 store,use,mixin 同步到 page
const {
uses,
mixins,
store
} = __VueOptions
uses && uses.forEach(use => {
Vue.use(use)
})
mixins && mixins.forEach(mixin => {
Vue.mixin(mixin)
})
store && (Vue.prototype.$store = store)
}
const injectRef = Object.getPrototypeOf(global) || global
const vueOptions = Object.create(null)
function Vue (options) {
if (options && options.store) {
vueOptions.store = options.store
}
}
Vue.use = function (plugin) {
(vueOptions.uses || (vueOptions.uses = [])).push(plugin)
}
Vue.mixin = function (mixin) {
(vueOptions.mixins || (vueOptions.mixins = [])).push(mixin)
}
Vue.component = function () {}
injectRef.__VueOptions = vueOptions
// 目前仅支持 store, use, mixin
export default Vue
......@@ -5,6 +5,8 @@ import {
import {
invokeCallbackHandler
} from 'uni-helpers/api'
import Vue from './framework/vue'
import {
getApp
......@@ -19,7 +21,8 @@ global.UniServiceJSBridge.invokeCallbackHandler = invokeCallbackHandler
// TODO 补充__uniRoutes?路由校验那里用到了
export default {
uni,
uni,
Vue,
getApp,
getCurrentPages
}
<template>
<div v-on="$listener">
<div v-on="$listeners">
<text>
<slot />
</text>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册