# 页面编辑器 -- 组件库

## 安装

```js
npm i -s @nebulars/editor-widgets
# or
yarn add @nebulars/editor-widgets
```

## 初始化

```js
import widgets from `@nebulars/editor-widgets`

Vue.use(widgets, { /* options */ });
```

## 使用

```html
<n-header />
```

## 组件数据格式

```js
{
  // 组件名称
  name: `header`,
  // 组件中文名
  label: `页头`,
  // 图标
  icon: ``,
  // 参数
  props: {
    // 配置参数
    option: {
      // 缺省类型（勿修改）
      type: [Object],
      // 默认参数
      default () {
        return {
          color: `red`
        }
      }
    },
    // 源数据
    source: { ... }
  }
}
```

## 面板参数示例

```js
{
  // 组件名称
  name: `header`,
  // 参数
  props: {
    // 配置参数
    option: {
      // 缺省类型（勿修改）
  	  type: [Object],
      // 默认参数
  	  default() {
  		  return {
          // ...
  		  }
  	  }
    }
  }
}
```