diff --git a/README.ja.md b/README.ja.md
index 2f43128c..0c49685b 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -30,7 +30,7 @@
## 概要
-[vue-element-admin](https://panjiachen.github.io/vue-element-admin) は管理画面のフロントエンドのインタフェース,[vue](https://github.com/vuejs/vue) と [element-ui](https://github.com/ElemeFE/element)を使っています。i18nの多言語対応、可変ルート、権限、典型的なビジネスアプリテンプレートであり、豊富なコンポーネントを提供しています、素早くビジネス用の管理画面の現型を構築に役立ちます。
+[vue-element-admin](https://panjiachen.github.io/vue-element-admin) は管理画面のフロントエンドのインタフェースで、[vue](https://github.com/vuejs/vue) と [element-ui](https://github.com/ElemeFE/element)を使っています。i18nの多言語対応、可変ルート、権限、典型的なビジネスアプリテンプレートであり、豊富なコンポーネントを提供しています。素早くビジネス用の管理画面の現型を構築に役立ちます。
- [デモページ](https://panjiachen.github.io/vue-element-admin)
@@ -44,18 +44,18 @@
- おすすめシンプルテンプレート: [vue-admin-template](https://github.com/PanJiaChen/vue-admin-template)
- デスクトップバージョン: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
-- Typescriptバージョン: [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (鸣谢: [@Armour](https://github.com/Armour))
+- Typescriptバージョン: [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (感謝: [@Armour](https://github.com/Armour))
- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
-**After the `v4.1.0+` version, the default master branch will not support i18n. Please use [i18n Branch](https://github.com/PanJiaChen/vue-element-admin/tree/i18n), it will keep up with the master update**
+**バージョン`v4.1.0+`以降について、デフォルトのmasterブランチではi18nをサポートしていません。masterブランチと共にアップデートされる[i18n Branch](https://github.com/PanJiaChen/vue-element-admin/tree/i18n)を使用してください。 **
-**現在のバージョン `v4.0+` は `vue-cli` で構築,バグ報告は[issue](https://github.com/PanJiaChen/vue-element-admin/issues/new)のissueでお願いします。旧バージョン[tag/3.11.0](https://github.com/PanJiaChen/vue-element-admin/tree/tag/3.11.0)もあります。`vue-cli`に依存しないです。**
+**現在のバージョン `v4.0+` は `vue-cli` で構築していて、バグ報告は[issue](https://github.com/PanJiaChen/vue-element-admin/issues/new)のissueでお願いします。旧バージョン[tag/3.11.0](https://github.com/PanJiaChen/vue-element-admin/tree/tag/3.11.0)もあります。こちらは`vue-cli`に依存しないです。**
**低いバージョンのブラウザはサーポートしないです(例えば ie),必要があれば polyfill を追加してください。 [詳細はこちら](https://github.com/PanJiaChen/vue-element-admin/wiki#babel-polyfill)**
## 前準備
-ローカル環境に [node](http://nodejs.org/) と [git](https://git-scm.com/)をインストールが必要です。[ES2015+](http://es6.ruanyifeng.com/)、[vue](https://cn.vuejs.org/index.html)、[vuex](https://vuex.vuejs.org/zh-cn/)、[vue-router](https://router.vuejs.org/zh-cn/) 、[vue-cli](https://github.com/vuejs/vue-cli) 、[axios](https://github.com/axios/axios) 和 [element-ui](https://github.com/ElemeFE/element)で開発しています。Requestは[Mock.js](https://github.com/nuysoft/Mock)のモックデータを使っています。
+ローカル環境に [node](http://nodejs.org/) と [git](https://git-scm.com/)のインストールが必要です。[ES2015+](http://es6.ruanyifeng.com/)、[vue](https://cn.vuejs.org/index.html)、[vuex](https://vuex.vuejs.org/zh-cn/)、[vue-router](https://router.vuejs.org/zh-cn/) 、[vue-cli](https://github.com/vuejs/vue-cli) 、[axios](https://github.com/axios/axios) と [element-ui](https://github.com/ElemeFE/element)で開発しています。Requestは[Mock.js](https://github.com/nuysoft/Mock)のモックデータを使っています。
**バグ修正や新規機能追加のissue と pull requestは大歓迎です。**
@@ -87,9 +87,9 @@ Become a sponsor and get your logo on our README on GitHub with a link to your s
- 多言語切替
- テーマ切替
- サイトメニュー(ルートから生成)
- - Breadcrumb Navigation
- - Tag Navigation
- - Svg Sprite Icon
+ - パンくずリストナビゲーション
+ - タブナビゲーション
+ - Svg Sprite アイコン
- ローカル/バックエンド モック データ
- Screenfull
@@ -104,33 +104,33 @@ Become a sponsor and get your logo on our README on GitHub with a link to your s
- リード
- Zip
-- Table
- - Dynamic Table
- - Drag And Drop Table
- - Inline Edit Table
+- テーブル
+ - ダイナミックテーブル
+ - ドラッグアンドドロップテーブル
+ - インラインエディットテーブル
-- Error Page
+- エラーページ
- 401
- 404
- コンポーネント
- - Avatar Upload
- - Back To Top
- - Drag Dialog
- - Drag Select
- - Drag Kanban
- - Drag List
- - SplitPane
+ - アバターアップロード
+ - トップに戻る
+ - ドラッグダイアログ
+ - ドラッグ選択
+ - ドラッグKanban
+ - ドラッグリスト
+ - ペインの分割
- Dropzone
- - Sticky
+ - スティッキー
- CountTo
-- Advanced Example
-- Error Log
-- Dashboard
-- Guide Page
+- 高度なサンプル
+- エラーログ
+- ダッシュボード
+- ガイドページ
- ECharts
-- Clipboard
+- クリップボード
- Markdown to html
```
@@ -150,7 +150,7 @@ npm install
npm run dev
```
-This will automatically open http://localhost:9527
+http://localhost:9527 が自動的に開きます。
## Build
@@ -178,11 +178,11 @@ npm run lint
npm run lint -- --fix
```
-Refer to [Documentation](https://panjiachen.github.io/vue-element-admin-site/guide/essentials/deploy.html) for more information
+詳細は [Documentation](https://panjiachen.github.io/vue-element-admin-site/guide/essentials/deploy.html) を参照してください。
## Changelog
-Detailed changes for each release are documented in the [release notes](https://github.com/PanJiaChen/vue-element-admin/releases).
+各リリースの詳細は [release notes](https://github.com/PanJiaChen/vue-element-admin/releases) にあります。
## Online Demo
diff --git a/mock/article.js b/mock/article.js
index bc236eb9..50218ae4 100644
--- a/mock/article.js
+++ b/mock/article.js
@@ -18,7 +18,7 @@ for (let i = 0; i < count; i++) {
forecast: '@float(0, 100, 2, 2)',
importance: '@integer(1, 3)',
'type|1': ['CN', 'US', 'JP', 'EU'],
- 'status|1': ['published', 'draft', 'deleted'],
+ 'status|1': ['published', 'draft'],
display_time: '@datetime',
comment_disabled: true,
pageviews: '@integer(300, 5000)',
@@ -29,7 +29,7 @@ for (let i = 0; i < count; i++) {
export default [
{
- url: '/article/list',
+ url: '/vue-element-admin/article/list',
type: 'get',
response: config => {
const { importance, type, title, page = 1, limit = 20, sort } = config.query
@@ -58,7 +58,7 @@ export default [
},
{
- url: '/article/detail',
+ url: '/vue-element-admin/article/detail',
type: 'get',
response: config => {
const { id } = config.query
@@ -74,7 +74,7 @@ export default [
},
{
- url: '/article/pv',
+ url: '/vue-element-admin/article/pv',
type: 'get',
response: _ => {
return {
@@ -92,7 +92,7 @@ export default [
},
{
- url: '/article/create',
+ url: '/vue-element-admin/article/create',
type: 'post',
response: _ => {
return {
@@ -103,7 +103,7 @@ export default [
},
{
- url: '/article/update',
+ url: '/vue-element-admin/article/update',
type: 'post',
response: _ => {
return {
diff --git a/mock/index.js b/mock/index.js
index 6907e861..196e2927 100644
--- a/mock/index.js
+++ b/mock/index.js
@@ -54,17 +54,4 @@ export function mockXHR() {
}
}
-// for mock server
-const responseFake = (url, type, respond) => {
- return {
- url: new RegExp(`/mock${url}`),
- type: type || 'get',
- response(req, res) {
- res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
- }
- }
-}
-
-export default mocks.map(route => {
- return responseFake(route.url, route.type, route.response)
-})
+export default mocks
diff --git a/mock/mock-server.js b/mock/mock-server.js
index 4c4cb2af..806fdacc 100644
--- a/mock/mock-server.js
+++ b/mock/mock-server.js
@@ -2,17 +2,21 @@ const chokidar = require('chokidar')
const bodyParser = require('body-parser')
const chalk = require('chalk')
const path = require('path')
+const Mock = require('mockjs')
const mockDir = path.join(process.cwd(), 'mock')
function registerRoutes(app) {
let mockLastIndex
const { default: mocks } = require('./index.js')
- for (const mock of mocks) {
+ const mocksForServer = mocks.map(route => {
+ return responseFake(route.url, route.type, route.response)
+ })
+ for (const mock of mocksForServer) {
app[mock.type](mock.url, mock.response)
mockLastIndex = app._router.stack.length
}
- const mockRoutesLength = Object.keys(mocks).length
+ const mockRoutesLength = Object.keys(mocksForServer).length
return {
mockRoutesLength: mockRoutesLength,
mockStartIndex: mockLastIndex - mockRoutesLength
@@ -27,6 +31,18 @@ function unregisterRoutes() {
})
}
+// for mock server
+const responseFake = (url, type, respond) => {
+ return {
+ url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
+ type: type || 'get',
+ response(req, res) {
+ console.log('request invoke:' + req.path)
+ res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
+ }
+ }
+}
+
module.exports = app => {
// es6 polyfill
require('@babel/register')
diff --git a/mock/remote-search.js b/mock/remote-search.js
index bb33c2f4..60809cb8 100644
--- a/mock/remote-search.js
+++ b/mock/remote-search.js
@@ -13,7 +13,7 @@ NameList.push({ name: 'mock-Pan' })
export default [
// username search
{
- url: '/search/user',
+ url: '/vue-element-admin/search/user',
type: 'get',
response: config => {
const { name } = config.query
@@ -30,7 +30,7 @@ export default [
// transaction list
{
- url: '/transaction/list',
+ url: '/vue-element-admin/transaction/list',
type: 'get',
response: _ => {
return {
diff --git a/mock/role/index.js b/mock/role/index.js
index 39148076..d957493b 100644
--- a/mock/role/index.js
+++ b/mock/role/index.js
@@ -38,7 +38,7 @@ const roles = [
export default [
// mock get all routes form server
{
- url: '/routes',
+ url: '/vue-element-admin/routes',
type: 'get',
response: _ => {
return {
@@ -50,7 +50,7 @@ export default [
// mock get all roles form server
{
- url: '/roles',
+ url: '/vue-element-admin/roles',
type: 'get',
response: _ => {
return {
@@ -62,7 +62,7 @@ export default [
// add role
{
- url: '/role',
+ url: '/vue-element-admin/role',
type: 'post',
response: {
code: 20000,
@@ -74,7 +74,7 @@ export default [
// update role
{
- url: '/role/[A-Za-z0-9]',
+ url: '/vue-element-admin/role/[A-Za-z0-9]',
type: 'put',
response: {
code: 20000,
@@ -86,7 +86,7 @@ export default [
// delete role
{
- url: '/role/[A-Za-z0-9]',
+ url: '/vue-element-admin/role/[A-Za-z0-9]',
type: 'delete',
response: {
code: 20000,
diff --git a/mock/user.js b/mock/user.js
index 43f93a04..859bd6f3 100644
--- a/mock/user.js
+++ b/mock/user.js
@@ -26,7 +26,7 @@ const users = {
export default [
// user login
{
- url: '/user/login',
+ url: '/vue-element-admin/user/login',
type: 'post',
response: config => {
const { username } = config.body
@@ -49,7 +49,7 @@ export default [
// get user info
{
- url: '/user/info\.*',
+ url: '/vue-element-admin/user/info\.*',
type: 'get',
response: config => {
const { token } = config.query
@@ -72,7 +72,7 @@ export default [
// user logout
{
- url: '/user/logout',
+ url: '/vue-element-admin/user/logout',
type: 'post',
response: _ => {
return {
diff --git a/package.json b/package.json
index 9942fbac..fb1e8d55 100644
--- a/package.json
+++ b/package.json
@@ -49,7 +49,7 @@
"driver.js": "0.9.5",
"dropzone": "5.5.1",
"echarts": "4.2.1",
- "element-ui": "2.7.0",
+ "element-ui": "2.13.0",
"file-saver": "2.0.1",
"fuse.js": "3.4.4",
"js-cookie": "2.2.0",
diff --git a/plop-templates/store/index.hbs b/plop-templates/store/index.hbs
new file mode 100644
index 00000000..4f8e2dc0
--- /dev/null
+++ b/plop-templates/store/index.hbs
@@ -0,0 +1,16 @@
+{{#if state}}
+const state = {}
+{{/if}}
+
+{{#if mutations}}
+const mutations = {}
+{{/if}}
+
+{{#if actions}}
+const actions = {}
+{{/if}}
+
+export default {
+ namespaced: true,
+ {{options}}
+}
diff --git a/plop-templates/store/prompt.js b/plop-templates/store/prompt.js
new file mode 100644
index 00000000..bcbc11d1
--- /dev/null
+++ b/plop-templates/store/prompt.js
@@ -0,0 +1,62 @@
+const { notEmpty } = require('../utils.js')
+
+module.exports = {
+ description: 'generate store',
+ prompts: [{
+ type: 'input',
+ name: 'name',
+ message: 'store name please',
+ validate: notEmpty('name')
+ },
+ {
+ type: 'checkbox',
+ name: 'blocks',
+ message: 'Blocks:',
+ choices: [{
+ name: 'state',
+ value: 'state',
+ checked: true
+ },
+ {
+ name: 'mutations',
+ value: 'mutations',
+ checked: true
+ },
+ {
+ name: 'actions',
+ value: 'actions',
+ checked: true
+ }
+ ],
+ validate(value) {
+ if (!value.includes('state') || !value.includes('mutations')) {
+ return 'store require at least state and mutations'
+ }
+ return true
+ }
+ }
+ ],
+ actions(data) {
+ const name = '{{name}}'
+ const { blocks } = data
+ const options = ['state', 'mutations']
+ const joinFlag = `,
+ `
+ if (blocks.length === 3) {
+ options.push('actions')
+ }
+
+ const actions = [{
+ type: 'add',
+ path: `src/store/modules/${name}.js`,
+ templateFile: 'plop-templates/store/index.hbs',
+ data: {
+ options: options.join(joinFlag),
+ state: blocks.includes('state'),
+ mutations: blocks.includes('mutations'),
+ actions: blocks.includes('actions')
+ }
+ }]
+ return actions
+ }
+}
diff --git a/plopfile.js b/plopfile.js
index 9f3147e2..57387bf1 100644
--- a/plopfile.js
+++ b/plopfile.js
@@ -1,7 +1,9 @@
const viewGenerator = require('./plop-templates/view/prompt')
const componentGenerator = require('./plop-templates/component/prompt')
+const storeGenerator = require('./plop-templates/store/prompt.js')
module.exports = function(plop) {
plop.setGenerator('view', viewGenerator)
plop.setGenerator('component', componentGenerator)
+ plop.setGenerator('store', storeGenerator)
}
diff --git a/src/api/article.js b/src/api/article.js
index f54b8af6..407bda16 100644
--- a/src/api/article.js
+++ b/src/api/article.js
@@ -2,7 +2,7 @@ import request from '@/utils/request'
export function fetchList(query) {
return request({
- url: '/article/list',
+ url: '/vue-element-admin/article/list',
method: 'get',
params: query
})
@@ -10,7 +10,7 @@ export function fetchList(query) {
export function fetchArticle(id) {
return request({
- url: '/article/detail',
+ url: '/vue-element-admin/article/detail',
method: 'get',
params: { id }
})
@@ -18,7 +18,7 @@ export function fetchArticle(id) {
export function fetchPv(pv) {
return request({
- url: '/article/pv',
+ url: '/vue-element-admin/article/pv',
method: 'get',
params: { pv }
})
@@ -26,7 +26,7 @@ export function fetchPv(pv) {
export function createArticle(data) {
return request({
- url: '/article/create',
+ url: '/vue-element-admin/article/create',
method: 'post',
data
})
@@ -34,7 +34,7 @@ export function createArticle(data) {
export function updateArticle(data) {
return request({
- url: '/article/update',
+ url: '/vue-element-admin/article/update',
method: 'post',
data
})
diff --git a/src/api/remote-search.js b/src/api/remote-search.js
index c7e19117..02e42b46 100644
--- a/src/api/remote-search.js
+++ b/src/api/remote-search.js
@@ -2,7 +2,7 @@ import request from '@/utils/request'
export function searchUser(name) {
return request({
- url: '/search/user',
+ url: '/vue-element-admin/search/user',
method: 'get',
params: { name }
})
@@ -10,7 +10,7 @@ export function searchUser(name) {
export function transactionList(query) {
return request({
- url: '/transaction/list',
+ url: '/vue-element-admin/transaction/list',
method: 'get',
params: query
})
diff --git a/src/api/role.js b/src/api/role.js
index f6a983f1..959bbd21 100644
--- a/src/api/role.js
+++ b/src/api/role.js
@@ -2,21 +2,21 @@ import request from '@/utils/request'
export function getRoutes() {
return request({
- url: '/routes',
+ url: '/vue-element-admin/routes',
method: 'get'
})
}
export function getRoles() {
return request({
- url: '/roles',
+ url: '/vue-element-admin/roles',
method: 'get'
})
}
export function addRole(data) {
return request({
- url: '/role',
+ url: '/vue-element-admin/role',
method: 'post',
data
})
@@ -24,7 +24,7 @@ export function addRole(data) {
export function updateRole(id, data) {
return request({
- url: `/role/${id}`,
+ url: `/vue-element-admin/role/${id}`,
method: 'put',
data
})
@@ -32,7 +32,7 @@ export function updateRole(id, data) {
export function deleteRole(id) {
return request({
- url: `/role/${id}`,
+ url: `/vue-element-admin/role/${id}`,
method: 'delete'
})
}
diff --git a/src/api/user.js b/src/api/user.js
index de69f707..b8b8741c 100644
--- a/src/api/user.js
+++ b/src/api/user.js
@@ -2,7 +2,7 @@ import request from '@/utils/request'
export function login(data) {
return request({
- url: '/user/login',
+ url: '/vue-element-admin/user/login',
method: 'post',
data
})
@@ -10,7 +10,7 @@ export function login(data) {
export function getInfo(token) {
return request({
- url: '/user/info',
+ url: '/vue-element-admin/user/info',
method: 'get',
params: { token }
})
@@ -18,7 +18,7 @@ export function getInfo(token) {
export function logout() {
return request({
- url: '/user/logout',
+ url: '/vue-element-admin/user/logout',
method: 'post'
})
}
diff --git a/src/components/Charts/mixins/resize.js b/src/components/Charts/mixins/resize.js
index dccaf1a8..b1e76e94 100644
--- a/src/components/Charts/mixins/resize.js
+++ b/src/components/Charts/mixins/resize.js
@@ -3,32 +3,54 @@ import { debounce } from '@/utils'
export default {
data() {
return {
- $_sidebarElm: null
+ $_sidebarElm: null,
+ $_resizeHandler: null
}
},
mounted() {
- this.__resizeHandler = debounce(() => {
- if (this.chart) {
- this.chart.resize()
- }
- }, 100)
- window.addEventListener('resize', this.__resizeHandler)
+ this.initListener()
+ },
+ activated() {
+ if (!this.$_resizeHandler) {
+ // avoid duplication init
+ this.initListener()
+ }
- this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0]
- this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler)
+ // when keep-alive chart activated, auto resize
+ this.resize()
},
beforeDestroy() {
- window.removeEventListener('resize', this.__resizeHandler)
-
- this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler)
+ this.destroyListener()
+ },
+ deactivated() {
+ this.destroyListener()
},
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_sidebarResizeHandler(e) {
if (e.propertyName === 'width') {
- this.__resizeHandler()
+ this.$_resizeHandler()
}
+ },
+ initListener() {
+ this.$_resizeHandler = debounce(() => {
+ this.resize()
+ }, 100)
+ window.addEventListener('resize', this.$_resizeHandler)
+
+ this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0]
+ this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler)
+ },
+ destroyListener() {
+ window.removeEventListener('resize', this.$_resizeHandler)
+ this.$_resizeHandler = null
+
+ this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler)
+ },
+ resize() {
+ const { chart } = this
+ chart && chart.resize()
}
}
}
diff --git a/src/components/MarkdownEditor/index.vue b/src/components/MarkdownEditor/index.vue
index 3d6794b5..1a8a01ee 100644
--- a/src/components/MarkdownEditor/index.vue
+++ b/src/components/MarkdownEditor/index.vue
@@ -12,7 +12,7 @@ import Editor from 'tui-editor'
import defaultOptions from './default-options'
export default {
- name: 'MarddownEditor',
+ name: 'MarkdownEditor',
props: {
value: {
type: String,
diff --git a/src/components/Share/DropdownMenu.vue b/src/components/Share/DropdownMenu.vue
index a629fe9a..d194a517 100644
--- a/src/components/Share/DropdownMenu.vue
+++ b/src/components/Share/DropdownMenu.vue
@@ -44,6 +44,7 @@ $t: .1s;
width: 250px;
position: relative;
z-index: 1;
+ height: auto!important;
&-title {
width: 100%;
display: block;
@@ -65,10 +66,12 @@ $t: .1s;
position: absolute;
width: 100%;
background: #e0e0e0;
+ color: #000;
line-height: 60px;
height: 60px;
cursor: pointer;
- font-size: 20px;
+ font-size: 18px;
+ overflow: hidden;
opacity: 1;
transition: transform 0.28s ease;
&:hover {
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index d9075a24..37bc1e69 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -36,8 +36,8 @@
Docs
-
- Log Out
+
+ Log Out
diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue
index 2d49dd87..a418c3d7 100644
--- a/src/layout/components/Sidebar/SidebarItem.vue
+++ b/src/layout/components/Sidebar/SidebarItem.vue
@@ -1,5 +1,5 @@
-