# darwin-flex-layout

> da-flex布局方案

Latest version **5.0.5** (published 2022-08-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install darwin-flex-layout
pnpm add darwin-flex-layout
yarn add darwin-flex-layout
bun add darwin-flex-layout
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.5 |
| Published | 2022-08-04 |
| First published | 2020-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 386.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rockey2020 |
| Maintainers | rockey2020 |
| Keywords | darwin-flex-layout, darwin, flex, layout, rockey2020 |

## Links

- npm: https://www.npmjs.com/package/darwin-flex-layout
- Repository: https://github.com/rockey2020/darwin-flex-layout
- Homepage: https://github.com/rockey2020/darwin-flex-layout#readme
- Issues: https://github.com/rockey2020/darwin-flex-layout/issues
- npm.io page: https://npm.io/package/darwin-flex-layout

## Dependencies (4)

- [ress](https://npm.io/package/ress.md) ^5.0.2
- [@swc/helpers](https://npm.io/package/@swc/helpers.md) ^0.4.3
- [regenerator-runtime](https://npm.io/package/regenerator-runtime.md) ^0.13.9
- [@babel/runtime-corejs3](https://npm.io/package/@babel/runtime-corejs3.md) ^7.18.6

## Recent versions

- 5.0.5 (latest) — 2022-08-04
- 5.0.4 — 2022-08-03
- 5.0.3 — 2022-08-03
- 5.0.2 — 2022-08-03
- 5.0.1 — 2022-07-16
- 5.0.0 — 2022-07-16
- 4.2.0 — 2022-07-14
- 4.1.0 — 2022-07-12
- 4.0.0 — 2022-07-05
- 3.0.4 — 2021-07-08
- 3.0.3 — 2021-07-08
- 3.0.2 — 2021-07-07
- 3.0.1 — 2021-07-07
- 3.0.0 — 2021-07-07
- 2.1.0 — 2021-03-08
- … 6 more at https://npm.io/package/darwin-flex-layout/versions

## README

# darwin-flex-layout

[![npm version](https://img.shields.io/npm/v/darwin-flex-layout.svg?style=flat-square)](https://www.npmjs.com/package/darwin-flex-layout)
[![jsdelivr](https://img.shields.io/jsdelivr/npm/hm/darwin-flex-layout.svg?style=flat-square)](https://www.jsdelivr.com/package/npm/darwin-flex-layout?path=dist%2Flegacy)

darwin-flex-layout是一套从多个完整成熟的大型项目总结出来的页面布局最佳实践方案，开箱即用。

基于flex实现了纯className即可简单快速搭建基础页面结构，降低了重复编写布局代码的时间，提高了开发效率。

除了提供flex布局方案，还有一些比较常见的工具类，例如设备平台的判断，样式重置，屏幕尺寸适配，以及精简的前端路由控制器等，特别适合应用在活动页面里面

文档地址:[https://rockey2020.github.io/darwin-flex-layout/](https://rockey2020.github.io/darwin-flex-layout/)

## 导航

- [安装方式](#安装方式)
- [使用例子(基于npm安装)](#使用例子(基于npm安装))
- [使用例子(基于浏览器引入方式安装)](#使用例子(基于浏览器引入方式安装))
- [DaFlex基本类名规则](#DaFlex基本类名规则)
- [License](#License)

## 安装方式

使用 npm:

```bash
$ npm install darwin-flex-layout -S
```

使用 yarn:

```bash
$ yarn add darwin-flex-layout
```

使用 pnpm:

```bash
$ pnpm add darwin-flex-layout
```

使用 jsDelivr CDN:

```html

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/darwin-flex-layout/dist/legacy/all/index.css">
<script src="https://cdn.jsdelivr.net/npm/darwin-flex-layout/dist/legacy/all/index.js"></script>
```

## 使用例子(基于npm安装)

```typescript
import Da from "darwin-flex-layout/dist/default/all" //推荐 默认导入样式  可通过Da调用附属工具类 同时默认在window挂载附属的工具类
import "darwin-flex-layout/dist/default/all"//默认在window挂载附属的工具类 默认导入样式
//又或者 导入自己想要的css或者js default下的任意目录都是独立的模块 可以按需导入
```

## 使用例子(基于浏览器引入方式安装)

```html

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/darwin-flex-layout/dist/legacy/all/index.css">
<script src="https://cdn.jsdelivr.net/npm/darwin-flex-layout/dist/legacy/all/index.js"></script>
<!--会在window对象上挂载一个Da对象,可通过Da调用对应的工具类-->
<!--与npm安装方式一样，支持单独模块的注册引用,只需要修改对应的引用文件地址-->
```

## DaFlex基本类名规则

所有的flex布局类名前缀都会有 da-flex

任何的包含 da-flex 的元素  都默认是垂直 左对齐

类名完全遵守flex属性命名规则例如 da-flex da-flex-inline da-flex-justify-center

只有任意父级元素className包含了 da-flex 子级的附属类名才会生效 例如父级有da-flex 子级使用da-flex-justify-center会生效 否则无效

da-flex-item 基于百分比宽度实现了从0-100的宽度类名 例如 da-flex-item-50 就是宽度为50%

```html
声明一个占满一行的div 内部包含两个垂直居中的盒子 且该行会自动换行
<div class="da-flex da-flex-wrap">
    <div class="da-flex da-flex-inline da-flex-item-50 da-flex-justify-center">
        <span>盒子1</span>
    </div>
    <div class="da-flex da-flex-inline da-flex-item-50 da-flex-justify-center">
        <span>盒子2</span>
    </div>
</div>

声明一个占满一行的div 内部包含两个垂直居中的盒子 且该div是一个列表模式
<div class="da-flex da-flex-column">
    <div class="da-flex da-flex-inline da-flex-item-100 da-flex-justify-center">
        <span>盒子1</span>
    </div>
    <div class="da-flex da-flex-inline da-flex-item-100 da-flex-justify-center">
        <span>盒子2</span>
    </div>
</div>
```

## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/darwin-flex-layout · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
