// es6
export var foo = 'foo';
setTimeout(() => foo = 'baz', 500);
// main
import {foo} from './t.js';
console.log(foo); // foo
setTimeout(() => console.log(foo), 500); // baz
yarn add xxx
添加新的 package,同时更新package.json
、yarn.lock
yarn upgrade xxx
更新 package,同时更新package.json
、yarn.lock
这样操作过后,我们把 yarn.lock
push 到代码仓库中
团队使用 Yarn 来管理模块依赖,这样只能保证大家的 yarn.lock
是一致的,但不能保证大家的 node_modules
是一致的(因为 node_modules
并不在版本库里)。要是有人升级了模块,别人拿到了新的 yarn.lock
,但是本地的 node_modules
里的模块仍然是旧的。
- 在入口文件(app.js)引入全局 css (
:global(.xxx){...}
),.xxx
不会被解析成 hash,可以在组件中className="xxx"
使用 - 本地css在组件(demo.js)中引入局部 css (
.yyy{...}
) ,在组件中styleName="yyy" 使用
common.css: global-style
:global(.xxx) {
...
在 reducer 中,都是返回一个新对象,否则组件是不会更新 ui 的。而返回新对象,可以:
Object.assign
:比较 hack,每次新生成一个对象...state
- immutable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { combineReducers } from 'redux'; | |
import globalDate from 'reducers/globalDate' | |
import permission from 'reducers/permission' | |
const createReducer = function (reducers) { | |
return combineReducers({ | |
/* 公共 reducers,无论一开始在哪个路由下,都会载入 */ | |
globalDate, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rime default settings | |
# encoding: utf-8 | |
patch: | |
config_version: "1.6" | |
schema_list: | |
- schema: luna_pinyin_simp | |
switcher: | |
caption: 〔方案選單〕 |
<Router>
<div className="router-container">
<Route exact path="/" component={ Home } />
<Route exact path="/search" component={ Search } />
</div>
</Router>
比如现在搜索要搜 t: text
和 s: abc
,路由应该是 /search?t=text&s=abc
| - your-theme
| - images # 主题相关图片资源
| - header.php # html 头部模板
| - footer.php # html 尾部模板
| - index.php # 首页模板
| - single.php # 文章模板
| - page.php # 页面模板
| - style.css