Skip to content

Commit

Permalink
v2.2.0 (修复一些Bug)
Browse files Browse the repository at this point in the history
1、权限示例demo错误
2、权限判断字段名错误
3、异步路由bug
  • Loading branch information
uncleLian committed Aug 5, 2019
1 parent 6562a6f commit 6b9e990
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-blog",
"version": "2.1.0",
"version": "2.2.0",
"private": true,
"scripts": {
"dev": "vue-cli-service serve",
Expand Down
2 changes: 1 addition & 1 deletion src/directive/permission/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
}

export function checkPermission(permissionRole) {
let currentRole = (store.state.user && store.state.user.role) || 'visitor'
let currentRole = (store.state.login.user && store.state.login.user.roles) || 'visitor'
if (typeof currentRole === 'string') {
currentRole = [currentRole]
}
Expand Down
3 changes: 2 additions & 1 deletion src/language/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ export default {
duration: 'Duration',
prefix: 'Prefix',
suffix: 'Suffix',
decimals: 'Decimals',
separator: 'Separator',
decimal: 'Decimal',
decimals: 'Decimals',
autoplay: 'Autoplay',
ease: 'Ease',
button: {
Expand Down
5 changes: 3 additions & 2 deletions src/language/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ export default {
duration: '时长',
prefix: '前缀',
suffix: '后缀',
decimals: '小数点符号',
decimal: '小数点后几位',
separator: '分隔符',
decimals: '小数点后几位',
decimal: '小数点符号',
autoplay: '自动开始',
ease: '平滑动画',
button: {
Expand Down
8 changes: 5 additions & 3 deletions src/layout/TagsView/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ export default {
scrollToCurrenTag() {
const tags = this.$refs.tags
this.$nextTick(() => {
for (const tag of tags) {
if (tag.to.path === this.$route.path) {
if (tags && tags.length > 0) {
for (const tag of tags) {
if (tag.to.path === this.$route.path) {
this.$refs.scrollPane.scrollTo(tag)
break
break
}
}
}
})
Expand Down
27 changes: 17 additions & 10 deletions src/pages/index/children/components-demo/numTo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<a href="/~https://github.com/uncleLian/vue-num-to" target="_blank">vue-num-to</a>
</div>
<div class="demo">
<vue-num-to class="number" ref="numTo" :startVal="startVal" :endVal="endVal" :duration="duration || 0" :autoplay="autoplay" :prefix="prefix" :suffix="suffix" :decimals="decimals" :decimal="decimal" :ease="ease" @complete="handleComplete">
<vue-num-to class="number" ref="numTo" :startVal="startVal" :endVal="endVal" :duration="duration || 0" :autoplay="autoplay" :prefix="prefix" :suffix="suffix" :separator="separator" :decimals="decimals" :decimal="decimal" :ease="ease" @complete="handleComplete">
</vue-num-to>
</div>
<div class="demo">
Expand Down Expand Up @@ -39,6 +39,12 @@
<template #prepend>{{$t('numTo.suffix')}}</template>
</el-input>
</div>
<!-- separator -->
<div class="demo-item">
<el-input :clearable="true" v-model.trim="separator">
<template #prepend>{{$t('numTo.separator')}}</template>
</el-input>
</div>
<!-- decimal -->
<div class="demo-item">
<el-input :clearable="true" v-model.trim="decimal">
Expand Down Expand Up @@ -69,15 +75,16 @@ export default {
name: 'numTo_view',
data() {
return {
startVal: 0,
endVal: new Date().getFullYear(),
duration: 3000,
prefix: '',
suffix: '',
decimal: '.',
decimals: 0,
autoplay: true,
ease: true
startVal: 0, // 开始值
endVal: new Date().getFullYear(), // 结束值
duration: 3000, // 时长
prefix: '', // 前缀
suffix: '', // 后缀
separator: ',', // 分隔符
decimal: '.', // 小数点符号
decimals: 0, // 小数点后几位
autoplay: true, // 是否自动开始
ease: true // 是否平滑过渡
}
},
methods: {
Expand Down
4 changes: 2 additions & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Vue.use(Router)
* icon: '' 菜单图标(支持svg-icon、el-icon)
* title: '' 菜单标题
* login: false 是否需要登录
* role: 'admin' || ['admin'] 是否需要权限
* ss: 'admin' || ['admin'] 是否需要权限
* keep: false 是否需要缓存(需要name才能生效)
* hidden: false 是否显示在菜单
* open: false 是否展开菜单(有子菜单前提下)
Expand Down Expand Up @@ -51,7 +51,7 @@ export const asyncRoutes = [
component: () => import('@/pages/index/children/permission/permission'),
meta: {
icon: 'lock',
role: 'admin'
roles: 'admin'
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
},
// 只做权限测试页使用
SET_ROLE(state, val) {
state.user.role = val
state.user.roles = val
}
},
actions: {
Expand Down
5 changes: 3 additions & 2 deletions src/store/modules/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export default {
actions: {
generateRoutes({ commit }) {
return new Promise(resolve => {
asyncParentRoutes.children = [...asyncRoutes, extraPanentRoutes]
const sideRoutes = setRedirect([asyncParentRoutes])
let finalAsyncParentRoutes = { ...asyncParentRoutes }
finalAsyncParentRoutes.children = [...asyncRoutes, extraPanentRoutes]
const sideRoutes = setRedirect([finalAsyncParentRoutes])
const addRoutes = [...sideRoutes, extraGlobalRoutes] // 实际动态添加的路由
const allRoutes = [...localRoutes, ...addRoutes] // 所有路由
commit('SET_SIDE_ROUTES', sideRoutes)
Expand Down

0 comments on commit 6b9e990

Please sign in to comment.