From d61ca41aa0bf59101b9ff4ce48d0c0d4a7674ea9 Mon Sep 17 00:00:00 2001 From: Aaron <427787340@qq.com> Date: Fri, 11 Oct 2019 16:29:41 +0800 Subject: [PATCH] 新增关键词输入器组件 --- .env | 2 +- examples/router/routes.js | 6 ++++++ examples/views/docs/component/keyword-input.md | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ examples/views/layout/component.vue | 4 ++-- lang/i18n.js | 6 ++++++ packages/index.js | 2 ++ packages/keyword-input/index.vue | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 253 insertions(+), 3 deletions(-) create mode 100644 examples/views/docs/component/keyword-input.md create mode 100644 packages/keyword-input/index.vue diff --git a/.env b/.env index 4ded078..e952756 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ # 版本号 -VUE_APP_VERSION = '0.5.3' +VUE_APP_VERSION = '0.5.4' # 自定义变量 Cookie失效时间 1天 VUE_APP_NAME = 'Eagle Web Tookit' \ No newline at end of file diff --git a/examples/router/routes.js b/examples/router/routes.js index 769d09d..f4bad39 100644 --- a/examples/router/routes.js +++ b/examples/router/routes.js @@ -30,6 +30,12 @@ const _components = [ meta: { title: 'Select 选择器' }, component: () => import('@/views/docs/component/select.md'), }, + { + path: 'keyword-input', + name: 'keyword-input', + meta: { title: 'KeywordInput 关键词输入器' }, + component: () => import('@/views/docs/component/keyword-input.md'), + }, ] }, { diff --git a/examples/views/docs/component/keyword-input.md b/examples/views/docs/component/keyword-input.md new file mode 100644 index 0000000..dd62291 --- /dev/null +++ b/examples/views/docs/component/keyword-input.md @@ -0,0 +1,62 @@ +# KeywordInput 关键词输入器 + +自定义输入一组数据以数组或者逗号分隔的方式记录 + +## 基础用法 + +::: snippet 默认返回值类型为`Array` + +```html + + + +``` + +::: + +## 字符串类型 + +::: snippet 返回值类型为`String` + +```html + + + +``` + +::: + +## API + +## Attribute 属性 + +参数|说明|类型|可选值|默认值 +-|-|-|-|- +value / v-model | 绑定值 | String,Array | - | - +placeholder | 占位文本 | String | - | 请输入 +unique | 唯一值,设置后不会出现相同的值 | Boolean | - | true +deletable | 是否能通过删除键删除上一个词 | Boolean | - | false +clearable | 是否可清空 | Boolean | - | false +type | 返回值类型 | String | array,string | array \ No newline at end of file diff --git a/examples/views/layout/component.vue b/examples/views/layout/component.vue index 6e5d9e9..1aaa66a 100644 --- a/examples/views/layout/component.vue +++ b/examples/views/layout/component.vue @@ -2,7 +2,7 @@ - +

开发指南

{{ doc.meta.title }} @@ -201,7 +201,7 @@ export default { } } .layout-main__component { - margin-left: 200px; + margin-left: 240px; margin-right: 150px; padding: 20px 40px; } diff --git a/lang/i18n.js b/lang/i18n.js index 8d272df..00b5329 100644 --- a/lang/i18n.js +++ b/lang/i18n.js @@ -41,6 +41,9 @@ export default { select: { select: '请选择', }, + input: { + input: '请输入' + } }, }, 'en-US': { @@ -85,6 +88,9 @@ export default { select: { select: 'Select', }, + input: { + input: 'Input' + } }, } } \ No newline at end of file diff --git a/packages/index.js b/packages/index.js index 9e274ba..1b99fae 100644 --- a/packages/index.js +++ b/packages/index.js @@ -8,6 +8,7 @@ import Form from './form' import ImageUpload from './Image-upload' import ImageUploadMultiple from './Image-upload/multiple' import ImageView from './image-view' +import KeywordInput from './keyword-input' import RadioGroup from './radio-group' import Scheme from './scheme' import Search from './search' @@ -28,6 +29,7 @@ const components = { ImageUpload, ImageUploadMultiple, ImageView, + KeywordInput, RadioGroup, Scheme, Search, diff --git a/packages/keyword-input/index.vue b/packages/keyword-input/index.vue new file mode 100644 index 0000000..08e3a11 --- /dev/null +++ b/packages/keyword-input/index.vue @@ -0,0 +1,174 @@ + + + + + -- libgit2 0.21.0