https://pmg1989.github.io/account/admin
角色: 教师 管理员 学生
https://github.com/pmg1989/dva-admin
//权限认证
https://pmg1989.github.io/account/admin
角色: 教师 管理员 学生
https://github.com/pmg1989/dva-admin
//权限认证
fake.js
'roleId|1': [1, 2, 3],
'roleName|1': function() {
return ["管理员", "教师", "学生"][this.roleId - 1]
},
// [array][index]
const arr = ["管理员", "教师", "学生"];
arr[0];
arr[1];
arr[2];
/*
["管理员", "教师", "学生"]
// (3) ["管理员", "教师", "学生"]
["管理员", "教师", "学生"][0];
//"管理员"
["管理员", "教师", "学生"][1];
//"教师"
["管理员", "教师", "学生"][2];
//"学生"
*/
https://gist.github.com/xyzdata/f2b41a63feb21081e9f51d464d7434d7#gistcomment-2141118
// 使用 Mock
import Mock from 'mockjs';
let data = Mock.mock({
// 属性 list 的值是一个数组,其中含有 1 到 10 个元素
'users|1-100': [{
// 属性 id 是一个自增数,起始值为 1,每次增 1
'id|+1': 101
}]
});
// 输出结果
console.log(
JSON.stringify(data, null, 4)
);
// JSON.stringify(value[, replacer[, space]]);
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
["管理员", "教师", "学生"][true+0]
// "教师"
["管理员", "教师", "学生"][false+0]
// "管理员"
'bm': '@boolean',
'isMale|1': function() {
return ["Man", "Woman"][this.bm + 0]
},
// 连字符转驼峰
String.prototype.hyphenToHump = function() {
return this.replace(/-(\w)/g, function() {
return arguments[1].toUpperCase()
});
};
// 驼峰转连字符
String.prototype.humpToHyphen = function() {
return this.replace(/([A-Z])/g, '-$1').toLowerCase();
};
H:\xgqfrms\Roles\src\utils\index.js
OK ???
import menu from './menu'
import Cookie from './cookie'
export config from './config'
export request from './request-mock'
export { color }
from './theme'
import menu from './menu';
import Cookie from './cookie';
import config from './config';
import request from './request-mock';
import {color} from './theme';
export { name1, name2, …, nameN };
export { variable1 as name1, variable2 as name2, …, nameN };
export let name1, name2, …, nameN; // also var
export let name1 = …, name2 = …, …, nameN; // also var, const
export default expression;
export default function (…) { … } // also class, function*
export default function name1(…) { … } // also class, function*
export { name1 as default, … };
export * from …;
export { name1, name2, …, nameN } from …;
export { import1 as name1, import2 as name2, …, nameN } from …;
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/export
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/import
import defaultMember from "module-name";
import * as name from "module-name";
import { member } from "module-name";
import { member as alias } from "module-name";
import { member1 , member2 } from "module-name";
import { member1 , member2 as alias2 , [...] } from "module-name";
import defaultMember, { member [ , [...] ] } from "module-name";
import defaultMember, * as name from "module-name";
import "module-name";
\src\routes
H:\xgqfrms\Roles\src\routes\account\Admin\ModalForm.js
{
title: '性别',
dataIndex: 'isMale',
key: 'isMale',
render: (text) => <span>{text
? '男'
: '女'}</span>
},
H:\xgqfrms\Roles\src\routes\account\Admin\List.js
\src\routes\
https://github.com/xgqfrms/React/blob/gh-pages/Redux-2017/redux-dataflow
Basic
Advanced
https://github.com/xgqfrms/RAIO/issues/6
https://github.com/pmg1989/dva-admin
npm start
C:\Users\xray.anyproxy_certs