中文 / English
neatlogic-web是neatlogic平台前端代码,所有子模块的前端代码都在neatlogic-web中。
neatlogic-web基于vue2.7.16,UI框架在iView4.x源码基础上经过调整。
vue/cli 5.x,webpack 5.x 先全局安装vue/cli最新版
npm install -g @vue/cli
npm install --registry=https://registry.npm.taobao.org
如果启动时发现大量不明报错,可能原因是npm install阶段加载的依赖包不完整导致,可以对npm进行降级再次install,目前测试v18的npm可以正常install。或者通过cnpm install加载依赖包也可以。cnpm版本也不能太高,建议使用v8.2.0。建议使用nvm管理多版本的node,使用v18.x版本的node会比较稳定。
sudo npm install -g cnpm@8.2.0 --registry=https://registry.npm.taobao.org
cnpm install
cnpm run build
需修改apiconfig.json配置文件,将tenantName的值修改为在用的租户(如果使用的是官方提供的用例数据,则租户就是demo),urlPrefix改成neatlogic后端tomcat服务的http://ip:port
cnpm run serve
cnpm run lint
https://www.cnblogs.com/weilai-info/p/10988829.html
为了统一代码风格,多人开发时不会出现格式错乱,进行二开时请使用相同的代码风格配置。
EsLint、vetur、Prettier - Code formatter、i18nhelper(自动进行i18n键值替换和多语言翻译)
{
"gitlens.views.repositories.files.layout": "list",
"git.confirmSync": false,
"gitlens.advanced.similarityThreshold": null,
"editor.tabSize": 2,
"vetur.validation.script": true,
"vetur.validation.style": true,
"vetur.format.defaultFormatter.html": "js-beautify-html",
"editor.formatOnSave": false,
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "auto",
"indent_size": 2,
"indent_char": " ",
"indent_with_tabs": false,
"eol": "\n",
"end_with_newline": true,
"preserve_newlines": true,
"max-preserve-newlines": 3,
"indent-inner-html": true,
"wrap_line_length": 120,
"editorconfig": true
}
},
"html.format.maxPreserveNewLines": 3,
"html.format.enable": false,
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[less]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"gitlens.advanced.blame.customArguments": [],
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[css]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"javascript.updateImportsOnFileMove.enabled": "always",
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[git-commit]": {
"editor.rulers": [
72
],
"workbench.editor.restoreViewState": false
},
"gitlens.advanced.messages": {},
"gitlens.gitCommands.closeOnFocusOut": true,
"workbench.startupEditor": "newUntitledFile",
"npm.enableRunFromFolder": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.autoClosingBrackets":"always",
"security.workspace.trust.untrustedFiles": "newWindow",
"workbench.editorAssociations": {
"*.html": "default"
},
"editor.unicodeHighlight.ambiguousCharacters": false,
"diffEditor.ignoreTrimWhitespace": false,
"eslint.alwaysShowStatus": true,
"eslint.format.enable": true,
"extensions.ignoreRecommendations": true,
"npm.keybindingsChangedWarningShown": true,
"settingsSync.ignoredSettings": [],
"window.zoomLevel": 1,
"typescript.disableAutomaticTypeAcquisition": true,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"eslint.codeActionsOnSave.rules": null
}
npm ERR! request to https://registry.npm.taobao.org/cnpm failed, reason: certificate has expired
npm config set strict-ssl false
cnpm update 依赖包名字
eg:cnpm update neatlogic-ui