forked from element-plus/element-plus
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed routing and loading svg issues
- Loading branch information
Showing
38 changed files
with
2,477 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*/**/*.js | ||
./src/i18n/**/*.ts | ||
*/**/*.js | ||
*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
{ | ||
"name": "crawlab-ui", | ||
"version": "0.6.0-beta.202109050019", | ||
"version": "0.6.0-beta.202109062027", | ||
"private": false, | ||
"author": { | ||
"name": "Marvin Zhang", | ||
"email": "[email protected]" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/crawlab-team/crawlab-ui" | ||
}, | ||
"license": "BSD-3", | ||
"scripts": { | ||
"serve": "vue-cli-service serve --port=8081", | ||
"serve:build:local": "vue-cli-service serve --port=8082 --model local", | ||
"serve:local": "vue-cli-service serve --port=8081 --mode local", | ||
"gen:index": "node ./scripts/gen-index.js", | ||
"gen:svg": "node ./scripts/gen-svg.js", | ||
"gen:dts": "node ./scripts/gen-dts.js", | ||
"prebuild": "yarn run prebuild:gen", | ||
"prebuild:gen": "yarn run gen:index", | ||
"prebuild:gen": "yarn run gen:index && yarn run gen:svg", | ||
"postbuild": "yarn run postbuild:gen", | ||
"postbuild:gen": "yarn run gen:dts", | ||
"build": "yarn run prebuild && yarn run build:lib && yarn run postbuild", | ||
|
@@ -76,7 +82,9 @@ | |
"@vue/cli-service": "~4.5.0", | ||
"@vue/compiler-sfc": "^3.0.0", | ||
"@vue/eslint-config-typescript": "^5.0.2", | ||
"base64-img": "^1.0.4", | ||
"chalk": "^4.1.2", | ||
"copy-webpack-plugin": "^6.0", | ||
"eslint": "^6.7.2", | ||
"eslint-plugin-vue": "^7.0.0-0", | ||
"esno": "^0.9.1", | ||
|
@@ -88,7 +96,8 @@ | |
"ts-morph": "^12.0.0", | ||
"typescript": "~3.9.3" | ||
}, | ||
"main": "dist/crawlab-ui.umd.js", | ||
"main": "dist/crawlab-ui.umd.min.js", | ||
"module": "dist/crawlab-ui.umd.min.js", | ||
"files": [ | ||
"dist", | ||
"typings" | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const path = require('path') | ||
const fs = require('fs') | ||
const klawSync = require('klaw-sync') | ||
const base64Img = require('base64-img') | ||
|
||
const includedFiles = [ | ||
'.svg', | ||
] | ||
const include = (path) => includedFiles.some(f => path.includes(f)) | ||
|
||
const genSvg = async() => { | ||
const root = path.resolve(__dirname, '../src/assets') | ||
const filePaths = klawSync(root, { | ||
nodir: true, | ||
}) | ||
.map(item => item.path) | ||
.filter(include) | ||
|
||
await Promise.all( | ||
filePaths.map(async file => { | ||
if (file.endsWith('.svg')) { | ||
const data = base64Img.base64Sync(file) | ||
|
||
const fileName = path.basename(file).replace(/\.svg$/, '.js') | ||
const dirPath = path.resolve(__dirname, `../src/assets/js/svg`) | ||
const filePath = `${dirPath}/${fileName}` | ||
|
||
if (!fs.existsSync(dirPath)) fs.mkdirSync(dirPath) | ||
|
||
let content = `module.exports = \`${data}\`` | ||
await fs.promises.writeFile(filePath, content, 'utf-8') | ||
} | ||
}) | ||
) | ||
} | ||
|
||
(async function () { | ||
await genSvg() | ||
})() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {createApp} from '@/package'; | ||
|
||
createApp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import {RouteRecordRaw} from 'vue-router'; | ||
import Home from '@/views/home/Home.vue'; | ||
|
||
const endpoint = ''; | ||
|
||
export default [ | ||
{ | ||
name: 'Home', | ||
path: endpoint, | ||
component: require('@/views/home/Home.vue'), | ||
component: Home, | ||
}, | ||
] as Array<RouteRecordRaw>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import {RouteRecordRaw} from 'vue-router'; | ||
import Login from '@/views/login/Login.vue'; | ||
|
||
const endpoint = '/login'; | ||
|
||
export default [ | ||
{ | ||
name: 'Login', | ||
path: endpoint, | ||
component: require('@/views/login/Login.vue'), | ||
component: Login, | ||
}, | ||
] as Array<RouteRecordRaw>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.