mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-05 19:41:57 +08:00
fix: 检测vue和@vue/compiler-sfc的版本,保证一致
This commit is contained in:
parent
5cca84e35a
commit
8e39dcf2c2
@ -30,7 +30,7 @@
|
||||
"@fesjs/utils": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ant-design/icons-vue": "^5.1.6",
|
||||
"@ant-design/icons-vue": "^6.0.0",
|
||||
"@fesjs/fes": "^2.0.0",
|
||||
"ant-design-vue": "^2.2.0",
|
||||
"vue": "^3.0.5"
|
||||
|
@ -5,8 +5,9 @@
|
||||
hide-add
|
||||
type="editable-card"
|
||||
@tabClick="switchPage"
|
||||
@edit="onEdit"
|
||||
>
|
||||
<a-tab-pane v-for="page in pageList" :key="page.path" closable>
|
||||
<a-tab-pane v-for="page in pageList" :key="page.path" :closable="route.path !== page.path">
|
||||
<template #tab>
|
||||
{{page.name}}
|
||||
<ReloadOutlined
|
||||
@ -100,6 +101,13 @@ export default {
|
||||
});
|
||||
}
|
||||
};
|
||||
const onEdit = (targetKey, action) => {
|
||||
if (action === 'remove') {
|
||||
const selectedPage = findPage(targetKey);
|
||||
const index = pageList.indexOf(selectedPage);
|
||||
pageList.splice(index, 1);
|
||||
}
|
||||
};
|
||||
const reloadPage = (path) => {
|
||||
const selectedPage = findPage(path || unref(route.path));
|
||||
if (selectedPage) {
|
||||
@ -119,7 +127,6 @@ export default {
|
||||
return '';
|
||||
};
|
||||
const handlerMore = ({ key }) => {
|
||||
console.log(key);
|
||||
switch (key) {
|
||||
case 'closeOtherPage':
|
||||
closeOtherPage();
|
||||
@ -136,7 +143,8 @@ export default {
|
||||
getPageKey,
|
||||
reloadPage,
|
||||
switchPage,
|
||||
handlerMore
|
||||
handlerMore,
|
||||
onEdit
|
||||
};
|
||||
}
|
||||
};
|
||||
|
@ -31,7 +31,7 @@
|
||||
"vue-i18n": "^9.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ant-design/icons-vue": "^5.1.6",
|
||||
"@ant-design/icons-vue": "^6.0.0",
|
||||
"@fesjs/fes": "^2.0.0",
|
||||
"ant-design-vue": "^2.2.0",
|
||||
"vue": "^3.0.5"
|
||||
|
@ -10,7 +10,7 @@ export default (api) => {
|
||||
} = api;
|
||||
|
||||
api.chainWebpack((memo) => {
|
||||
memo.resolve.alias.set('vue-i18n', 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js');
|
||||
memo.resolve.alias.set('vue-i18n', 'vue-i18n/dist/vue-i18n.esm-bundler.js');
|
||||
});
|
||||
|
||||
api.describe({
|
||||
|
@ -70,5 +70,8 @@
|
||||
"webpack-chain": "^6.5.1",
|
||||
"webpack-dev-server": "^3.11.2",
|
||||
"webpackbar": "^5.0.0-3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/compiler-sfc": "^3.0.5"
|
||||
}
|
||||
}
|
@ -45,6 +45,7 @@ export default function () {
|
||||
require.resolve('./plugins/features/mock'),
|
||||
require.resolve('./plugins/features/dynamicImport'),
|
||||
require.resolve('./plugins/features/runtimePublicPath'),
|
||||
require.resolve('./plugins/features/checkVuePackage'),
|
||||
|
||||
// misc
|
||||
require.resolve('./plugins/misc/route'),
|
||||
|
@ -0,0 +1,30 @@
|
||||
import { chalk, semver } from '@fesjs/utils';
|
||||
|
||||
export default (api) => {
|
||||
api.describe({
|
||||
key: 'checkVuePackage',
|
||||
config: {
|
||||
schema(joi) {
|
||||
return joi.object();
|
||||
},
|
||||
default: {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
api.onStart(() => {
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const vuePkg = require('vue/package.json');
|
||||
const vueCompilerPkg = require('@vue/compiler-sfc/package.json');
|
||||
if (
|
||||
!semver.satisfies(vuePkg.version, vueCompilerPkg.version, { includePrerelease: true })
|
||||
) {
|
||||
console.log(
|
||||
chalk.red(
|
||||
`You are using vue@${vuePkg.version}, requires @vue/compiler-sfc@${vuePkg.version}.\nPlease upgrade your @vue/compiler-sfc@${vueCompilerPkg.version} version.`
|
||||
)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
};
|
@ -49,7 +49,7 @@
|
||||
"@fesjs/fes": "^2.0.0",
|
||||
"@fesjs/plugin-access": "^2.0.0",
|
||||
"@fesjs/plugin-layout": "^2.0.0",
|
||||
"@fesjs/plugin-locale": "^2.0.0",
|
||||
"@fesjs/plugin-locale": "^2.0.1",
|
||||
"@fesjs/plugin-model": "^2.0.0",
|
||||
"@fesjs/plugin-enums": "^2.0.0",
|
||||
"@fesjs/plugin-jest": "^2.0.0",
|
||||
|
@ -8,9 +8,11 @@ import Spin from 'ant-design-vue/lib/spin';
|
||||
import 'ant-design-vue/lib/spin/style/css';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Spin
|
||||
},
|
||||
setup() {
|
||||
return {
|
||||
Spin
|
||||
};
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user