# concise-layout-ui

> - [准备](#准备) - [使用组件](#使用组件) - [导入框架UI组件](#导入框架ui组件) - [运行框架UI组件](#运行框架ui组件) - [框架UI导出内容](#框架UI导出内容) - [axios](#axios) - [layout](#layout) - [IconsData](#iconsdata) - [LayoutLR](#layoutlr) - [TransitionEx](#transitionex) - [框

Latest version **1.1.48** (published 2024-12-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install concise-layout-ui
pnpm add concise-layout-ui
yarn add concise-layout-ui
bun add concise-layout-ui
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.48 |
| Published | 2024-12-03 |
| First published | 2020-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 10.5 MB |
| Known vulnerabilities | 0 (+27 in 3 direct dependencies) |
| Install scripts | no |
| Maintainers | zhangxiansheng7778 |

## Links

- npm: https://www.npmjs.com/package/concise-layout-ui
- Repository: http://gitlab.archser.com/concise/layout-ui
- npm.io page: https://npm.io/package/concise-layout-ui

## Dependencies (15)

- [qs](https://npm.io/package/qs.md) ^6.9.1
- [md5](https://npm.io/package/md5.md) ^2.2.1
- [vue](https://npm.io/package/vue.md) 2.6.10
- [vuex](https://npm.io/package/vuex.md) ^3.1.2
- [axios](https://npm.io/package/axios.md) ^0.19.0
- [vue-qr](https://npm.io/package/vue-qr.md) ^3.2.4
- [core-js](https://npm.io/package/core-js.md) ^2.6.10
- [js-base64](https://npm.io/package/js-base64.md) ^2.5.2
- [js-cookie](https://npm.io/package/js-cookie.md) ^2.2.0
- [vue-router](https://npm.io/package/vue-router.md) ^3.1.3
- [view-design](https://npm.io/package/view-design.md) 4.4.0
- [identicon.js](https://npm.io/package/identicon.js.md) ^2.3.3
- [normalize.css](https://npm.io/package/normalize.css.md) ^8.0.1
- [vue-drag-resize](https://npm.io/package/vue-drag-resize.md) ^1.5.4
- [velocity-animate](https://npm.io/package/velocity-animate.md) ^1.5.2

## Recent versions

- 1.1.48 (latest) — 2024-12-03
- 1.1.47 — 2024-12-03
- 1.1.42 — 2022-12-16
- 1.0.1-secrecy — 2022-04-11
- 1.0.0-secrecy — 2022-04-07
- 1.1.41 — 2022-04-06
- 1.1.40 — 2022-03-31
- 1.1.39 — 2022-03-31
- 1.1.38 — 2022-03-14
- 1.1.37 — 2022-02-10
- 1.1.36 — 2022-01-26
- 1.1.35 — 2022-01-25
- 1.1.34 — 2022-01-25
- 1.1.33 — 2022-01-25
- 1.1.32 — 2022-01-25
- … 41 more at https://npm.io/package/concise-layout-ui/versions

## README

# layout-ui 框架UI

## 目录

- [准备](#准备)
- [使用组件](#使用组件)
   - [导入框架UI组件](#导入框架ui组件)
   - [运行框架UI组件](#运行框架ui组件)
- [框架UI导出内容](#框架UI导出内容)
   - [axios](#axios)
   - [layout](#layout)
   - [IconsData](#iconsdata)
   - [LayoutLR](#layoutlr)
   - [TransitionEx](#transitionex)
- [框架UI集成内容](#框架UI集成内容)
   - [clickoutside命令](#clickoutside命令)
- [发布](#发布)

## 准备

设置私服地址

```bash
npm config set registry http://peeek.cn:7001/
```

## 使用组件

```
npm install @concise/layout-ui
```

### 导入框架UI组件

导入框架UI的入口函数和样式

```js
import { layout } from '@concise/layout-ui'
import '@concise/layout-ui/dist/layout-ui.css'
```

### 运行框架UI组件

```js
layout(routeConfig, storeConfig, appConfig)
```

- routeConfig 参考[这里](https://router.vuejs.org/zh/api/#router-构建选项)。顶层路由存在子路由时无需执行 `component` 属性，例：

```js
{
  routes: [
    {
      path: '/',
      name: 'home',
      redirect: '/home',
      children: [
        {
          path: 'home',
          name: 'home_index',
          meta: {
            title: '应用管理'
          },
          component: () => import('@/views/app/App.vue')
        },
        {
          path: 'setting',
          name: 'setting',
          meta: {
            title: '配置'
          },
          component: () => import('@/views/setting/Setting.vue')
        }
      ]
    }
  ]
}
```

- storeConfig 参考[这里](https://vuex.vuejs.org/zh/api/#vuex-store-构造器选项)

> 虽然storeConfig中的state、mutations、actions、modules会分别于框架内部对应的属性合并，但我们建议仅定义自己的modules，然后合并到框架内部，这样便于状态的模块化管理，更易于解耦，避免发生与 `rootState` 冲突。下面是 `rootState` 数据，包含用户信息、全局配置、应用菜单等信息：

```js
{
  state: {
    config: {}
    userInfo: {
      avatar：'',
      name: ''
    },
    apps: [],
    token: ''
  }
}
```

- appConfig

|配置项|说明|
|----|----|
|app|应用名称|
|logo|应用左上角logo|
|name|应用中文名称|
|cookieExpires|cookie超期时间, 默认1天|

``` js
{
  app: 'concise',
  logo: '/logo.png',
  name: '全国邮政数字档案室系统',
  cookieExpires: 1
}
```

## 框架UI导出内容

```js
import {
  axios,
  layout,
  IconsData,
  LayoutLR,
  TransitionEx
} from '@concise/layout-ui'
```

### axios

HTTP 客户端，框架UI封装后的axios实例对象。
- 请求参数处理，参数采用 `application/x-www-form-urlencoded; charset=UTF-8` 标准头。
- 失败响应拦截器，统一拦截处理异常错误。

### layout

参见 [运行框架UI组件](#运行框架UI组件)

### IconsData

字体图标数据集，可以提供选择图标场景使用。使用 `Font Awesome` v4.7版本。具体图标示例参考 [官方网站](https://fontawesome.com/v4.7.0/icons/)，或者访问框架UI的图标示例路由 `/icons/index`。

示例：

```js
{
  icons: [
    {
      name: 'Glass',
      id: 'glass',
      unicode: 'f000',
      created: 1,
      filter: ['martini', 'drink', 'bar', 'alcohol', 'liquor'],
      categories: ['Web Application Icons']
    },
    {
      name: 'Music',
      id: 'music',
      unicode: 'f001',
      created: 1,
      filter: ['note', 'sound'],
      categories: ['Web Application Icons']
    },
    ...
  ]
}
```

### LayoutLR

比较常用的左右布局样式的Vue组件。

示例：

```html
<LayoutLR title="消息中心">
  <div slot="left">
    左侧内容
  </div>
  <div slot="right">
    右侧内容
  </div>
</LayoutLR>
```

- 属性

|属性名|类型|说明|
|-----|----|----|
|title|String|布局左上角显示内容，作为醒目的标题显示|

- 插槽

|插槽名|说明|
|-----|----|
|title|布局左上角显示内容，作为醒目的标题显示，替换同名 `title` 属性|
|left|左侧内容，可以放置菜单选项等|
|right|右侧内容，放置主要业务逻辑界面|

### TransitionEx

封装常用的过渡动画Vue组件。过渡动画使用 [Velocity.js](http://velocityjs.org)实现。

示例，内容显示时的样式从隐藏状态变为透明度0.3的样式，内容隐藏时则相反：

```html
<TransitionEx :show="showStyle" :hidden="hiddenStyle">
  <div>
    过渡动画应用内容
  </div>
</LayoutLR>
```

```js
export default {
  data () {
    return {
      showStyle: { opacity: 0.3 },
      hiddenStyle: { opacity: 0 }
    }
  }
}
```

- 属性

|属性名|类型|说明|
|-----|----|----|
|before|Object|进入过渡动画前的样式，可以为空|
|show|Object、String|内容显示时的样式，或者Velocity.js支持的动画指令|
|hidden|Object、String|内容隐藏时的样式，或者Velocity.js支持的动画指令|

- 插槽

默认插槽，过渡动画应用的内容

## 框架UI集成内容

### clickoutside命令

框架UI对Vue组件扩展了 `v-clickoutside` 命令，使用 `v-clickoutside` 命令可以处理元素外部点击事件。下面是示例：

```html
<template>
  <div v-clickoutside="handleOut">
    内容
  </div>
</template>
```

```js
handleOut () {
  console.log('点击了内容元素外部区域')
}
```

## 发布

> 每次发布前要升级 `package.json`中的 `version`

编译打包

```bash
npm run dist
```

登录私服，按提示输入用户名密码

```bash
npm login --registry=http://peeek.cn:7001/
```

发布

```bash
npm publish --registry=http://peeek.cn:7001/
```

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