Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/mars-build/src/compiler/file/compileModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,16 @@ async function compileUIModules(uiModules, destPath) {
const coreEntry = require.resolve(realName + '/mars-core', {
paths: [process.cwd()]
});
const entry = coreEntry.replace('mars-core/index.js', '');
// 获取当前操作系统的路径分隔符,否则windwos环境替换不成功
const entry = coreEntry.replace(`mars-core${path.sep}index.js`, '');
const dest = path.resolve(destPath, modPath);
const coreDestPath = path.resolve(destPath, 'mars-core');
const uiCoreDestPath = path.resolve(dest, 'mars-core');
// 修改windows环境反斜杠为斜杠
const coreRelativePath = path.relative(
uiCoreDestPath,
coreDestPath
);
).replace(/\\/g, '/');
if (fs.existsSync(uiCoreDestPath + '/index.js')) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/mars-build/src/gulp-mars-h5.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ async function compile(file, opt) {
}

// 持续集成 main.js pageTitleMap
let filePathKey = rPath.replace(/\.vue$/, '');
// windwos环境下的反斜杠替换为斜杠,否则输出的pageTitleMap为空
let filePathKey = rPath.replace(/\.vue$/, '').replace(/\\/g, '/');
const isComp = config.component;
if (!isComp) {
pagesInfo[filePathKey] = config;
Expand Down
3 changes: 2 additions & 1 deletion packages/mars-core/src/base/createComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import config from '../config';

export function makeVueCompCreator(getCompMixin) {
return function vueCompCreator(options) {
options.mixins = [getCompMixin(options)];
// 如果 options(vue组件的代码)中已有 mixins,则同时保留 options中的 mixins
options.mixins = [getCompMixin(options), ...options.mixins || []];
return options;
};
}
Expand Down
3 changes: 2 additions & 1 deletion packages/mars-core/src/base/createPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export function makeCreatePage(pageMixin, {handleProxy, handleModel}, setData, c
$api
}) {
return function (options) {
options.mixins = [pageMixin];
// 如果 options(vue页面的代码)中已有 mixins,则同时保留 options中的 mixins
options.mixins = [pageMixin, ...options.mixins || []];

let initData = typeof options.data === 'function' ? options.data.call({
$api
Expand Down