File tree Expand file tree Collapse file tree 9 files changed +35
-23
lines changed
pages/index/children/components-demo Expand file tree Collapse file tree 9 files changed +35
-23
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " vue-blog" ,
3- "version" : " 2.1 .0" ,
3+ "version" : " 2.2 .0" ,
44 "private" : true ,
55 "scripts" : {
66 "dev" : " vue-cli-service serve" ,
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export default {
1111}
1212
1313export function checkPermission ( permissionRole ) {
14- let currentRole = ( store . state . user && store . state . user . role ) || 'visitor'
14+ let currentRole = ( store . state . login . user && store . state . login . user . roles ) || 'visitor'
1515 if ( typeof currentRole === 'string' ) {
1616 currentRole = [ currentRole ]
1717 }
Original file line number Diff line number Diff line change @@ -77,8 +77,9 @@ export default {
7777 duration : 'Duration' ,
7878 prefix : 'Prefix' ,
7979 suffix : 'Suffix' ,
80- decimals : 'Decimals ' ,
80+ separator : 'Separator ' ,
8181 decimal : 'Decimal' ,
82+ decimals : 'Decimals' ,
8283 autoplay : 'Autoplay' ,
8384 ease : 'Ease' ,
8485 button : {
Original file line number Diff line number Diff line change @@ -77,8 +77,9 @@ export default {
7777 duration : '时长' ,
7878 prefix : '前缀' ,
7979 suffix : '后缀' ,
80- decimals : '小数点符号' ,
81- decimal : '小数点后几位' ,
80+ separator : '分隔符' ,
81+ decimals : '小数点后几位' ,
82+ decimal : '小数点符号' ,
8283 autoplay : '自动开始' ,
8384 ease : '平滑动画' ,
8485 button : {
Original file line number Diff line number Diff line change @@ -114,10 +114,12 @@ export default {
114114 scrollToCurrenTag () {
115115 const tags = this .$refs .tags
116116 this .$nextTick (() => {
117- for (const tag of tags) {
118- if (tag .to .path === this .$route .path ) {
117+ if (tags && tags .length > 0 ) {
118+ for (const tag of tags) {
119+ if (tag .to .path === this .$route .path ) {
119120 this .$refs .scrollPane .scrollTo (tag)
120- break
121+ break
122+ }
121123 }
122124 }
123125 })
Original file line number Diff line number Diff line change 55 <a href =" https://github.com/uncleLian/vue-num-to" target =" _blank" >vue-num-to</a >
66 </div >
77 <div class =" demo" >
8- <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" >
8+ <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" >
99 </vue-num-to >
1010 </div >
1111 <div class =" demo" >
3939 <template #prepend >{{$t('numTo.suffix')}}</template >
4040 </el-input >
4141 </div >
42+ <!-- separator -->
43+ <div class =" demo-item" >
44+ <el-input :clearable =" true" v-model.trim =" separator" >
45+ <template #prepend >{{$t('numTo.separator')}}</template >
46+ </el-input >
47+ </div >
4248 <!-- decimal -->
4349 <div class =" demo-item" >
4450 <el-input :clearable =" true" v-model.trim =" decimal" >
@@ -69,15 +75,16 @@ export default {
6975 name: ' numTo_view' ,
7076 data () {
7177 return {
72- startVal: 0 ,
73- endVal: new Date ().getFullYear (),
74- duration: 3000 ,
75- prefix: ' ¥' ,
76- suffix: ' ' ,
77- decimal: ' .' ,
78- decimals: 0 ,
79- autoplay: true ,
80- ease: true
78+ startVal: 0 , // 开始值
79+ endVal: new Date ().getFullYear (), // 结束值
80+ duration: 3000 , // 时长
81+ prefix: ' ¥' , // 前缀
82+ suffix: ' ' , // 后缀
83+ separator: ' ,' , // 分隔符
84+ decimal: ' .' , // 小数点符号
85+ decimals: 0 , // 小数点后几位
86+ autoplay: true , // 是否自动开始
87+ ease: true // 是否平滑过渡
8188 }
8289 },
8390 methods: {
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ Vue.use(Router)
1111* icon: '' 菜单图标(支持svg-icon、el-icon)
1212* title: '' 菜单标题
1313* login: false 是否需要登录
14- * role : 'admin' || ['admin'] 是否需要权限
14+ * ss : 'admin' || ['admin'] 是否需要权限
1515* keep: false 是否需要缓存(需要name才能生效)
1616* hidden: false 是否显示在菜单
1717* open: false 是否展开菜单(有子菜单前提下)
@@ -51,7 +51,7 @@ export const asyncRoutes = [
5151 component : ( ) => import ( '@/pages/index/children/permission/permission' ) ,
5252 meta : {
5353 icon : 'lock' ,
54- role : 'admin'
54+ roles : 'admin'
5555 }
5656 } ,
5757 {
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export default {
1313 } ,
1414 // 只做权限测试页使用
1515 SET_ROLE ( state , val ) {
16- state . user . role = val
16+ state . user . roles = val
1717 }
1818 } ,
1919 actions : {
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ export default {
1717 actions : {
1818 generateRoutes ( { commit } ) {
1919 return new Promise ( resolve => {
20- asyncParentRoutes . children = [ ...asyncRoutes , extraPanentRoutes ]
21- const sideRoutes = setRedirect ( [ asyncParentRoutes ] )
20+ let finalAsyncParentRoutes = { ...asyncParentRoutes }
21+ finalAsyncParentRoutes . children = [ ...asyncRoutes , extraPanentRoutes ]
22+ const sideRoutes = setRedirect ( [ finalAsyncParentRoutes ] )
2223 const addRoutes = [ ...sideRoutes , extraGlobalRoutes ] // 实际动态添加的路由
2324 const allRoutes = [ ...localRoutes , ...addRoutes ] // 所有路由
2425 commit ( 'SET_SIDE_ROUTES' , sideRoutes )
You can’t perform that action at this time.
0 commit comments