diff --git a/examples/router/routes.js b/examples/router/routes.js index a0ff018..f1a0ff0 100644 --- a/examples/router/routes.js +++ b/examples/router/routes.js @@ -16,13 +16,19 @@ const _guides = [ meta: { title: '安装' }, component: () => import('@/views/docs/guide/installation.md'), }, + { + path: 'specification', + name: 'specification', + meta: { title: '说明' }, + component: () => import('@/views/docs/guide/specification.md'), + }, ]; // 组件页面的文档 const _components = [ { - group: '通用', + group: '基础组件', children: [ { path: 'button', @@ -42,18 +48,39 @@ const _components = [ meta: { title: 'Icon 图标' }, component: () => import('@/views/docs/component/icon.md'), }, + ] + }, + { + group: '展示组件', + children: [ + { + path: 'steps', + name: 'steps', + meta: { title: 'Steps 步骤条' }, + component: () => import('@/views/docs/component/steps.md'), + }, { path: 'tag', name: 'tag', meta: { title: 'Tag 标签' }, component: () => import('@/views/docs/component/tag.md'), }, + ] + }, + { + group: '反馈组件', + children: [ { path: 'popup', name: 'popup', meta: { title: 'Popup 弹出框' }, component: () => import('@/views/docs/component/popup.md'), }, + ] + }, + { + group: '导航组件', + children: [ { path: 'nav-bar', name: 'nav-bar', @@ -66,32 +93,18 @@ const _components = [ meta: { title: 'TabBar 标签栏' }, component: () => import('@/views/docs/component/tab-bar.md'), }, - { - path: 'steps', - name: 'steps', - meta: { title: 'Steps 步骤条' }, - component: () => import('@/views/docs/component/steps.md'), - }, ] }, +]; + +const _others = [ { - group: '其它', - children: [ - { - path: 'specification', - name: 'specification', - meta: { title: 'Specification 说明' }, - component: () => import('@/views/docs/component/specification.md'), - }, - { - path: 'other', - name: 'other', - meta: { title: 'Other 其它' }, - component: () => import('@/views/page/other'), - }, - ] - } -] + path: 'other', + name: 'other', + meta: { title: '其它' }, + component: () => import('@/views/page/other'), + }, +]; let _components_children = []; _components.forEach(data => { @@ -117,13 +130,14 @@ const _pages = [ meta: { title: '组件', path: '/component' }, component: ComponentLayout, redirect: `/component/${_guides[0].path || 'detail'}`, - children: [..._components_children, ..._guides] + children: [..._components_children, ..._guides, ..._others] } ] export const pages = _pages; export const guides = _guides; export const components = _components; +export const others = _others; export default [ { path: '*', redirect: '/404', hidden: true }, diff --git a/examples/views/docs/component/cell.md b/examples/views/docs/component/cell.md index 115d37c..8c19cdc 100644 --- a/examples/views/docs/component/cell.md +++ b/examples/views/docs/component/cell.md @@ -1,58 +1,132 @@ # Cell 单元格 -单元格 +常用单元格 ## 基础用法 -单元格说明 +基础单元格包括**标题**, **内容**, **描述** -::: snippet 示例 +::: snippet 配置`title`属性显示标题, 配置`value`属性显示内容, 配置`label`属性显示描述 ```html + + +``` + +::: + +## 显示图标 + +单元格支持显示左侧图标 + +::: snippet 支持配置`icon`属性显示图标,也可通过`icon`插槽配置自定义内容 + +```html + + + +``` + +::: + +## 点击效果 + +支持配置`is-link`属性显示点击效果,配置`right-icon`属性改变右侧图标,配置`right`插槽自定义右侧内容 + +::: snippet 配置`right-icon`属性改变右侧图标 + +```html + + + +``` + +::: + +## 综合示例 + +一个常用的单元格示例 + +::: snippet 综合示例 + +```html + - - ``` -::: \ No newline at end of file +::: + +## API + +## Attribute 属性 + +参数|说明|类型|可选值|默认值 +-|-|-|-|- +icon | 图标 | String | - | - +title | 标题 | String | - | - +value | 内容 | String | - | - +label | 标签 | String | - | - +isLink | 是否显示点击效果 | Boolean | - | - +rightIcon | 右侧图标 | String | - | enter + +## Events 事件 + +事件名称|说明|回调参数 +-|-|- +click | 按钮点击事件 | - \ No newline at end of file diff --git a/examples/views/docs/component/specification.md b/examples/views/docs/component/specification.md deleted file mode 100644 index 7c6b5eb..0000000 --- a/examples/views/docs/component/specification.md +++ /dev/null @@ -1,105 +0,0 @@ -## 说明 - -### 项目说明 - -ZUI是则一针对APICloud开发的基于Vue的H5组件库。 - -#### 项目结构 - -```bash -├── README.md # 说明文件 -├── babel.config.js -├── examples # 项目展示,相当于正常Vue项目的src -│   ├── App.vue -│   ├── assets -│   ├── components # 项目展示用到的组件 -│   ├── main.js -│   ├── router -│   │   ├── index.js -│   │   └── routes.js # 静态路由配置文件 -│   ├── store.js -│   ├── styles -│   └── views # 视图文件 -│   ├── docs # markdown格式的页面目录 -│   │   ├── component -│   │   │   ├── button.md -│   │   │   ├── cell.md -│   │   │   ├── icon.md -│   │   │   ├── specification.md -│   │   │   └── tag.md -│   │   └── guide -│   │   ├── installation.md -│   │   └── introduce.md -│   ├── layout # 项目的布局 -│   │   ├── component.vue -│   │   ├── components -│   │   │   └── header.vue -│   │   └── default.vue -│   └── page # 非markdown格式的页面 -│   ├── error -│   │   └── 404.vue -│   ├── index.vue -│   └── other.vue -├── package.json -├── packages -├── postcss.config.js -├── public -├── vue.config.js -└── webpack -    └── markdown-loader.js # 对vue-cli进行markdown扩展 -``` - -### 开发流程 - -ZUI组件库的开发流程与基本Vue组件开发流程类似,但略有不同。 - -> 需要注意 -> * 样式使用`CSS`编写,不使用任何预编译手段。 -> * 组件编写时,`禁止`出现`ES6`语法。 - -#### 开发步骤 - -新增一个组件的步骤如下: - -1. 在`packages`目录下创建组件文件 -2. 在`examples/views/docs/component`目录下创建对应的markdown文件 -3. 在`examples/router/routes.js`文件中的`_components`中创建对应组件的路由 -4. 编写步骤2已创建的markdown文件 - -编写组件markdown文件的步骤如下: - -1. 编写对应组件名称,格式为 **[首字母大写的组件名] + [组件中文名]** -2. 编写组件说明 -3. 编写组件不同状态下的使用方法 -4. 编写组件示例代码段,代码段以`::: snippet [代码段说明]`开头,以`:::`结尾 - -### APICloud应用 - -本组件库适用于默认的APICloud开发流程,即未经过编译的html文件通过script引入vue的方式。 - -1. 在APICloud的`components`目录下(或其它组件目录,没有的话新建一个)新建一个组件名称对应的js文件。如:**components/zui/button.js** -2. 编写js形式的Vue组件, 如: - -```js -if (Vue) { - Vue.component( - 'zui-button', - { - name: 'Button', - // ... 本项目中对应本组件的.vue文件中的方法,如data、computed、methods等 - template: '
' + - '' + - '
', // 把本项目中.vue文件中的template通过字符串拼接的形式拼接起来,注意引号兼容 - } - ) -} - -``` - -> 这里需要注意字符串拼接时,容易出现引号兼容问题,因此在编写.vue文件时,尽量注意不要直接在template中出现单引号 - -3. 新建一个与.js文件同名的.css文件 -4. 将本项目中对应组件的css复制到新建的.css文件中 -5. 在需要引用组件的APICloud页面通过`