wilsonyiyi / blog Goto Github PK
View Code? Open in Web Editor NEWhttps://wilsonyiyi.github.io/blog/
https://wilsonyiyi.github.io/blog/
Row的实现简单的堆加了样式,样式规则row-{flex布局}-{flex水平/垂直方向}
render() {
const { type, justify, align, className, ...others } = this.props;
const classes = classNames({
row: true,
[`row-${type}`]: type,
[`row-${type}-${justify}`]: justify,
[`row-${type}-${align}`]: align,
[className]: className,
});
return <div {...others} className={classes}>{ this.props.children }</div>;
},
Col的实现。之前一致对pull和push的概念模糊,业务中使用率不高。刚想了下,如果都以左侧起点作为参照点,push即远离左侧,pull即拉向左侧(往左侧靠)。
render() {
const { span, order, offset, push, pull, className, ...others } = this.props;
const classes = classNames({
[`col-${span}`]: span,
[`col-order-${order}`]: order,
[`col-offset-${offset}`]: offset,
[`col-push-${push}`]: push,
[`col-pull-${pull}`]: pull,
[className]: className,
});
return <div {...others} className={classes}>{ this.props.children }</div>;
},
核心样式代码,一个循环解决栅格系统的样式问题
.loop-grid-columns(@index) when (@index > 0) {
.col-@{index} {
width: percentage((@index / @grid-columns));
}
.col-push-@{index} {
left: percentage((@index / @grid-columns));
}
.col-pull-@{index} {
right: percentage((@index / @grid-columns));
}
.col-offset-@{index} {
margin-left: percentage((@index / @grid-columns));
}
.col-order-@{index} {
order: @index;
}
.loop-grid-columns((@index - 1));
}
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.