From bb71db59bab58a66e566ad2bbc2194e4f23c3c7e Mon Sep 17 00:00:00 2001
From: supergaojian <402853745@qq.com>
Date: Tue, 2 Apr 2019 20:31:45 +0800
Subject: [PATCH] feat(Ruler):add new component (#382)
---
components/index.js | 3 +
components/ruler/README.en-US.md | 34 +++
components/ruler/README.md | 34 +++
components/ruler/component.js | 7 +
components/ruler/demo/cases/demo0.vue | 37 +++
components/ruler/demo/cases/demo1.vue | 39 +++
components/ruler/demo/cases/demo2.vue | 49 ++++
components/ruler/demo/index.vue | 26 ++
components/ruler/index.vue | 354 ++++++++++++++++++++++++++
components/ruler/test/index.spec.js | 16 ++
examples/components.json | 2 +-
examples/demo-index.js | 2 +-
12 files changed, 601 insertions(+), 2 deletions(-)
create mode 100644 components/ruler/README.en-US.md
create mode 100644 components/ruler/README.md
create mode 100644 components/ruler/component.js
create mode 100644 components/ruler/demo/cases/demo0.vue
create mode 100644 components/ruler/demo/cases/demo1.vue
create mode 100644 components/ruler/demo/cases/demo2.vue
create mode 100644 components/ruler/demo/index.vue
create mode 100644 components/ruler/index.vue
create mode 100644 components/ruler/test/index.spec.js
diff --git a/components/index.js b/components/index.js
index 50b2b3770..7bbaab1eb 100644
--- a/components/index.js
+++ b/components/index.js
@@ -58,6 +58,7 @@ import Transition from './transition'
import DetailItem from './detail-item'
import Slider from './slider'
import Progress from './progress'
+import Ruler from './ruler'
/* @init<%import ${componentNameUpper} from './${componentName}'%> */
// Totally importing reminder
@@ -125,6 +126,7 @@ export const components = {
DetailItem,
Slider,
Progress,
+ Ruler,
/* @init<%${componentNameUpper},%> */
}
@@ -213,6 +215,7 @@ export {
DetailItem,
Slider,
Progress,
+ Ruler,
/* @init<%${componentNameUpper},%> */
}
diff --git a/components/ruler/README.en-US.md b/components/ruler/README.en-US.md
new file mode 100644
index 000000000..6f6f3a7ff
--- /dev/null
+++ b/components/ruler/README.en-US.md
@@ -0,0 +1,34 @@
+---
+title: Ruler
+preview: https://didi.github.io/mand-mobile/examples/#/ruler
+---
+
+Sliding selection
+
+### Import
+
+```javascript
+import { Ruler } from 'mand-mobile'
+
+Vue.component(Ruler.name, Ruler)
+```
+
+### Code Examples
+
+
+### API
+
+#### [Ruler] Props
+|Props | Description | Type | Default | Note|
+|----|-----|------|------|------|
+|v-model|current value|Number|0|-|
+|scope|ruler scope|Number[]|[0, 100]|-|
+|step|each large distance of the scale|Number|10|-|
+|unit|scale each small distance|Number|1|-|
+|min|minimum|Number|0|-|
+|max|maximum|Number|100|-|
+
+#### [Ruler] Events
+
+##### @change(currentValue)
+Change value
diff --git a/components/ruler/README.md b/components/ruler/README.md
new file mode 100644
index 000000000..4df27f186
--- /dev/null
+++ b/components/ruler/README.md
@@ -0,0 +1,34 @@
+---
+title: Ruler 刻度尺
+preview: https://didi.github.io/mand-mobile/examples/#/ruler
+---
+
+滑动选择
+
+### 引入
+
+```javascript
+import { Ruler } from 'mand-mobile'
+
+Vue.component(Ruler.name, Ruler)
+```
+
+### 代码演示
+
+
+### API
+
+#### [Ruler] Props
+|属性 | 说明 | 类型 | 默认值 | 备注 |
+|----|-----|------|------|------|
+|v-model|双向绑定的值|Number|0|-|
+|scope|刻度尺范围|Number[]|[0, 100]|-|
+|step|刻度尺每一大格步数|Number|10|-|
+|unit|刻度尺每一小格步数|Number|1|-|
+|min|最小可滑动位置|Number|0|-|
+|max|最大可滑动位置|Number|100|-|
+
+#### [Ruler] Events
+
+##### @change(currentValue)
+值发生变化事件
diff --git a/components/ruler/component.js b/components/ruler/component.js
new file mode 100644
index 000000000..02e605104
--- /dev/null
+++ b/components/ruler/component.js
@@ -0,0 +1,7 @@
+export default {
+ "name": "ruler",
+ "text": "刻度尺",
+ "category": "form",
+ "description": "刻度尺",
+ "author": "supergaojian <402853745@qq.com>"
+}
\ No newline at end of file
diff --git a/components/ruler/demo/cases/demo0.vue b/components/ruler/demo/cases/demo0.vue
new file mode 100644
index 000000000..d53bf7c51
--- /dev/null
+++ b/components/ruler/demo/cases/demo0.vue
@@ -0,0 +1,37 @@
+
+
+
当前值:{{ value }}
+
+
+
+
+
+
+
+
+
diff --git a/components/ruler/demo/cases/demo1.vue b/components/ruler/demo/cases/demo1.vue
new file mode 100644
index 000000000..6d70f9a12
--- /dev/null
+++ b/components/ruler/demo/cases/demo1.vue
@@ -0,0 +1,39 @@
+
+
+
当前值:{{ value }}
+
+
+
+
+
+
+
+
+
diff --git a/components/ruler/demo/cases/demo2.vue b/components/ruler/demo/cases/demo2.vue
new file mode 100644
index 000000000..574e0b0a5
--- /dev/null
+++ b/components/ruler/demo/cases/demo2.vue
@@ -0,0 +1,49 @@
+
+
+
当前值:{{ value }}
+
+
+
+
+
+
+
+
+
diff --git a/components/ruler/demo/index.vue b/components/ruler/demo/index.vue
new file mode 100644
index 000000000..c5bd079fc
--- /dev/null
+++ b/components/ruler/demo/index.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
diff --git a/components/ruler/index.vue b/components/ruler/index.vue
new file mode 100644
index 000000000..e813d36e9
--- /dev/null
+++ b/components/ruler/index.vue
@@ -0,0 +1,354 @@
+
+
+
+
+
+
+
diff --git a/components/ruler/test/index.spec.js b/components/ruler/test/index.spec.js
new file mode 100644
index 000000000..d6b615f73
--- /dev/null
+++ b/components/ruler/test/index.spec.js
@@ -0,0 +1,16 @@
+import SingleComponent from '../index'
+import {mount} from 'avoriaz'
+
+describe('SingleComponent', () => {
+ let wrapper
+
+ afterEach(() => {
+ wrapper && wrapper.destroy()
+ })
+
+ it('create a simple ruler', () => {
+ wrapper = mount(SingleComponent)
+
+ expect(wrapper.hasClass('md-ruler')).to.be.true
+ })
+})
diff --git a/examples/components.json b/examples/components.json
index 12afd6a58..423dc7d1d 100644
--- a/examples/components.json
+++ b/examples/components.json
@@ -1 +1 @@
-[{"category":"basic","name":"Basic","text":"基础","list":[{"name":"ActionBar","path":"/action-bar","icon":"action-bar","text":"操作栏"},{"name":"ActivityIndicator","path":"/activity-indicator","icon":"activity-indicator","text":"活动指示器"},{"path":"/button","name":"Button","icon":"button","text":"按钮"},{"name":"CellItem","path":"/cell-item","icon":"cell-item","text":"列表单元"},{"name":"DetailItem","path":"/detail-item","icon":"detail-item","text":"清单项"},{"name":"DropMenu","path":"/drop-menu","icon":"drop-menu","text":"下拉菜单"},{"path":"/icon","name":"Icon","icon":"icon","text":"图标"},{"name":"ImageReader","path":"/image-reader","icon":"image-reader","text":"图片选择器"},{"name":"ImageViewer","path":"/image-viewer","icon":"image-viewer","text":"图片浏览器"},{"name":"NoticeBar","path":"/notice-bar","icon":"notice-bar","text":"通知栏"},{"name":"Progress","path":"/progress","icon":"progress","text":"进度"},{"name":"Stepper","path":"/stepper","icon":"stepper","text":"步进器"},{"name":"Steps","path":"/steps","icon":"steps","text":"步骤条"},{"name":"Swiper","path":"/swiper","icon":"swiper","text":"轮播"},{"name":"TabBar","path":"/tab-bar","icon":"tab-bar","text":"标签栏"},{"name":"Tabs","path":"/tabs","icon":"tabs","text":"标签页"},{"name":"Tag","path":"/tag","icon":"tag","text":"标签"}]},{"category":"business","name":"Business","text":"业务相关","list":[{"name":"Amount","path":"/amount","icon":"amount","text":"金融数字"},{"name":"Bill","path":"/bill","icon":"bill","text":"票据"},{"name":"Captcha","path":"/captcha","icon":"captcha","text":"验证码窗口"},{"name":"Cashier","path":"/cashier","icon":"cashier","text":"收银台"},{"name":"Chart","path":"/chart","icon":"chart","text":"折线图表"},{"name":"Landscape","path":"/landscape","icon":"landscape","text":"压屏窗"},{"name":"ResultPage","path":"/result-page","icon":"result-page","text":"结果页"},{"name":"WaterMark","path":"/water-mark","icon":"water-mark","text":"水印"}]},{"category":"feedback","name":"Feedback","text":"操作反馈","list":[{"name":"ActionSheet","path":"/action-sheet","icon":"action-sheet","text":"动作面板"},{"name":"DatePicker","path":"/date-picker","icon":"date-picker","text":"日期选择器"},{"name":"Dialog","path":"/dialog","icon":"dialog","text":"模态窗"},{"name":"Picker","path":"/picker","icon":"picker","text":"选择器"},{"name":"Popup","path":"/popup","icon":"popup","text":"弹出层"},{"name":"Selector","path":"/selector","icon":"selector","text":"列表选择器"},{"name":"TabPicker","path":"/tab-picker","icon":"tab-picker","text":"多频道选择器"},{"name":"Tip","path":"/tip","icon":"tip","text":"气泡提示"},{"name":"Toast","path":"/toast","icon":"toast","text":"轻提示"},{"name":"Transition","path":"/transition","icon":"transition","text":"动画"}]},{"category":"form","name":"Form","text":"表单相关","list":[{"name":"Agree","path":"/agree","icon":"agree","text":"勾选按钮"},{"name":"Check","path":"/check","icon":"check","text":"选择项组"},{"name":"Codebox","path":"/codebox","icon":"codebox","text":"字符码输入框"},{"name":"Field","path":"/field","icon":"field","text":"区域列表组合"},{"name":"InputItem","path":"/input-item","icon":"input-item","text":"输入框"},{"name":"NumberKeyboard","path":"/number-keyboard","icon":"number-keyboard","text":"数字键盘"},{"name":"Radio","path":"/radio","icon":"radio","text":"单选框"},{"name":"Slider","path":"/slider","icon":"slider","text":"滑块"},{"name":"Switch","path":"/switch","icon":"switch","text":"开关"}]},{"category":"gesture","name":"Gesture","text":"手势","list":[{"name":"ScrollView","path":"/scroll-view","icon":"scroll-view","text":"滚动区域/下拉刷新"}]}]
\ No newline at end of file
+[{"category":"basic","name":"Basic","text":"基础","list":[{"name":"ActionBar","path":"/action-bar","icon":"action-bar","text":"操作栏"},{"name":"ActivityIndicator","path":"/activity-indicator","icon":"activity-indicator","text":"活动指示器"},{"path":"/button","name":"Button","icon":"button","text":"按钮"},{"name":"CellItem","path":"/cell-item","icon":"cell-item","text":"列表单元"},{"name":"DetailItem","path":"/detail-item","icon":"detail-item","text":"清单项"},{"name":"DropMenu","path":"/drop-menu","icon":"drop-menu","text":"下拉菜单"},{"path":"/icon","name":"Icon","icon":"icon","text":"图标"},{"name":"ImageReader","path":"/image-reader","icon":"image-reader","text":"图片选择器"},{"name":"ImageViewer","path":"/image-viewer","icon":"image-viewer","text":"图片浏览器"},{"name":"NoticeBar","path":"/notice-bar","icon":"notice-bar","text":"通知栏"},{"name":"Progress","path":"/progress","icon":"progress","text":"进度"},{"name":"Stepper","path":"/stepper","icon":"stepper","text":"步进器"},{"name":"Steps","path":"/steps","icon":"steps","text":"步骤条"},{"name":"Swiper","path":"/swiper","icon":"swiper","text":"轮播"},{"name":"TabBar","path":"/tab-bar","icon":"tab-bar","text":"标签栏"},{"name":"Tabs","path":"/tabs","icon":"tabs","text":"标签页"},{"name":"Tag","path":"/tag","icon":"tag","text":"标签"}]},{"category":"business","name":"Business","text":"业务相关","list":[{"name":"Amount","path":"/amount","icon":"amount","text":"金融数字"},{"name":"Bill","path":"/bill","icon":"bill","text":"票据"},{"name":"Captcha","path":"/captcha","icon":"captcha","text":"验证码窗口"},{"name":"Cashier","path":"/cashier","icon":"cashier","text":"收银台"},{"name":"Chart","path":"/chart","icon":"chart","text":"折线图表"},{"name":"Landscape","path":"/landscape","icon":"landscape","text":"压屏窗"},{"name":"ResultPage","path":"/result-page","icon":"result-page","text":"结果页"},{"name":"WaterMark","path":"/water-mark","icon":"water-mark","text":"水印"}]},{"category":"feedback","name":"Feedback","text":"操作反馈","list":[{"name":"ActionSheet","path":"/action-sheet","icon":"action-sheet","text":"动作面板"},{"name":"DatePicker","path":"/date-picker","icon":"date-picker","text":"日期选择器"},{"name":"Dialog","path":"/dialog","icon":"dialog","text":"模态窗"},{"name":"Picker","path":"/picker","icon":"picker","text":"选择器"},{"name":"Popup","path":"/popup","icon":"popup","text":"弹出层"},{"name":"Selector","path":"/selector","icon":"selector","text":"列表选择器"},{"name":"TabPicker","path":"/tab-picker","icon":"tab-picker","text":"多频道选择器"},{"name":"Tip","path":"/tip","icon":"tip","text":"气泡提示"},{"name":"Toast","path":"/toast","icon":"toast","text":"轻提示"},{"name":"Transition","path":"/transition","icon":"transition","text":"动画"}]},{"category":"form","name":"Form","text":"表单相关","list":[{"name":"Agree","path":"/agree","icon":"agree","text":"勾选按钮"},{"name":"Check","path":"/check","icon":"check","text":"选择项组"},{"name":"Codebox","path":"/codebox","icon":"codebox","text":"字符码输入框"},{"name":"Field","path":"/field","icon":"field","text":"区域列表组合"},{"name":"InputItem","path":"/input-item","icon":"input-item","text":"输入框"},{"name":"NumberKeyboard","path":"/number-keyboard","icon":"number-keyboard","text":"数字键盘"},{"name":"Radio","path":"/radio","icon":"radio","text":"单选框"},{"name":"Ruler","path":"/ruler","icon":"ruler","text":"刻度尺"},{"name":"Slider","path":"/slider","icon":"slider","text":"滑块"},{"name":"Switch","path":"/switch","icon":"switch","text":"开关"}]},{"category":"gesture","name":"Gesture","text":"手势","list":[{"name":"ScrollView","path":"/scroll-view","icon":"scroll-view","text":"滚动区域/下拉刷新"}]}]
\ No newline at end of file
diff --git a/examples/demo-index.js b/examples/demo-index.js
index 1b41470ba..efa3cd096 100644
--- a/examples/demo-index.js
+++ b/examples/demo-index.js
@@ -46,4 +46,4 @@ export {default as Transition} from '../components/transition/demo'
export {default as DetailItem} from '../components/detail-item/demo'
export {default as Slider} from '../components/slider/demo'
export {default as Progress} from '../components/progress/demo'
-/* @init<%export {default as ${componentNameUpper}} from '../components/${componentName}/demo'%> */
+export {default as Ruler} from '../components/ruler/demo'
/* @init<%export {default as ${componentNameUpper}} from '../components/${componentName}/demo'%> */