Skip to content

Commit

Permalink
chore: update lib name
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitjinfeiyang committed Aug 28, 2020
1 parent 8c619e9 commit 4bfbc28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 简介
使用render函数,在canvas中创建文档流,实现静态布局.
点击查看 [DEMO](https://gitjinfeiyang.github.io/easyFlow/example/)

*点击查看 [DEMO](https://gitjinfeiyang.github.io/easyFlow/example/)*

- 支持文档流,参照web,无需设置x、y以及宽高
- 兼容小程序以及web,无第三方依赖
Expand Down Expand Up @@ -44,15 +45,17 @@
- [x] position `static` `absolute`


## Screenshot
![1](screenshot/01.png)
## Installation

``` bash
npm install easy-canvas-layout --save
```

## Usage

### Basic
``` javascript
import ef from 'easyflow'
import easyCanvas from 'easy-canvas-layout'

const canvas = document.querySelector('#canvas')

Expand All @@ -62,15 +65,15 @@
ctx.scale(2, 2)

// create a layer bind with ctx
const layer = ef.createLayer(ctx, {
const layer = easyCanvas.createLayer(ctx, {
dpr: 2,
width: 300,
height: 600,
canvas // 小程序环境必传
})

// create a node tree
const node = ef.createElement((c) => {
const node = easyCanvas.createElement((c) => {
return c('view', { styles: { backgroundColor:'#000' } }, [
c('text',{color:'#fff'},'Hello World')
])
Expand Down Expand Up @@ -114,9 +117,9 @@
)
}

ef.component('button',(opt,children,c) => button(c,children))
easyCanvas.component('button',(opt,children,c) => button(c,children))

const node = ef.createElement((c) => {
const node = easyCanvas.createElement((c) => {
return c('view',{},[
c('button',{},'这是全局组件')
])
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "easy-canvas",
"name": "easy-canvas-layout",
"version": "0.0.1",
"description": "A canvas lib helps us easy to layout with canvas.",
"description": "A canvas tool to help easy layout in canvas.",
"main": "./lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand All @@ -17,7 +17,7 @@
"bugs": {
"url": "https://github.com/Gitjinfeiyang/easyFlow/issues"
},
"homepage": "https://github.com/Gitjinfeiyang/easyFlow#readme",
"homepage": "https://github.com/Gitjinfeiyang/easy-canvas#readme",
"devDependencies": {
"rollup-plugin-terser": "^7.0.0"
}
Expand Down

0 comments on commit 4bfbc28

Please sign in to comment.