umijs / umi Goto Github PK
View Code? Open in Web Editor NEWA framework in react community ✨
Home Page: https://umijs.org
License: MIT License
A framework in react community ✨
Home Page: https://umijs.org
License: MIT License
I get jest-runtime
errors
FAIL src/components/Authorized/CheckPermissions.test.js
Test suite failed to run
TypeError: Jest: a transform must export a `process` function.
at ScriptTransformer._getTransformer (node_modules/jest-runtime/build/script_transformer.js:152:15)
at Generator.next (<anonymous>)
This issue doesn't exist in 0.3.0
only in 0.3.1
Please see ant-design/ant-design-pro#776 for more information
1.0
1.x
UMI_LANG=zh-cn umi dev
原来的方式:
dynamic(resolve);
支持传入 loading 组件:
dynamic(resolve, {
loading,
});
在 config.js 中,配置 loading 指向返回 LoadComponent 的文件。
{
"loading": "./PageLoadingComponent"
}
$ ROUTER=none umi build
"node_modules/af-webpack/lib",
"node_modules/umi-build-dev"
# Normal usage
$ umi build --plugins path/to/plugin.js
# Multiple plugins
$ umi build --plugins path/to/plugin1.js,path/to/plugin2.js
This will merge with plugins
in config.js.
"define": { "process.env.contextPath": process.env.contextPath, }
这样定义出错,请问这样的方式怎样指定process.env中的值?
emit({ type: 'pageInitialized' });
umi/packages/af-webpack/src/getConfig.js
Line 42 in 9799a86
.ts
, .tsx
结尾的入口文件$ HTML=none umi build
<Link to="xx">link</Link>
or
router.push('/path')
can change url and route to new page, but can't trigger state change in umi+dva project.
Subscription and life-circle method like componentWillReceiveProps will not run.
Internal requirement, not recommend, don't use it.
$ PRIVATE_DISABLE_DYNAMIC=1 umi build
在项目中的文件路径:umi/packages/af-webpack/
文案定位: API - af-webpack/dev - Options 第四条 beforeServer 应为 afterServer
<Link to="/test-page" className={styles.test}>
<FormattedMessage id="lang.message" />
</Link>
will generate the following HTML, can't click.
<span>some message</span>
<Link to="/test-page" className={styles.test}>
<span>some message</span>
</Link>
will generate the same HTML as in (1.), it can be clicked, but with no pointer
cursor.
<Link to="/test-page" className={styles.test}>
<a><FormattedMessage id="lang.message" /></a>
</Link>
this works fine.
I think it's a bug.
Another thing, Link only accept one child, the following code will throw an exception.
<Link to='xxx'>
<Icon class=''/> Message
</Link>
I can create page file pages/search/person.js to match /search/person.html
Can I put parameters in url?
/search/person/:query/:n
I did this before with react-rotuer:
User: {
path: '/user/:id',
models: () => [import('models/user/detail')],
component: () => import('./detail/'),
},
umi/packages/af-webpack/src/dev.js
Line 16 in 9a8ea3f
Seems that variable HOST is hard-coded here.
To my understanding, roadhog 2+ depends on this and the doc of which indicates HOST can be customized.
How about change it to:
const HOST = process.env.HOST || '0.0.0.0'
I am refactoring my project using umi.
As shown In this example https://github.com/umijs/umi/tree/master/examples/with-dva
Each page has a new instance of dva, Is this the right way to use dva in umi?
If so, models can't share it's data between pages. but I want to share data just like before in dva with react-router@4.
What's the best way to use dva-no-router in umi?
Two problems:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.