From 2cb8a6d93e7705490f5045e737a292360505a0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=81=8F?= Date: Wed, 23 Nov 2016 16:27:17 +0800 Subject: [PATCH] commit Table component commit Table component --- src/components/table/index.js | 2 + src/components/table/table-body.vue | 21 ++++ src/components/table/table-column.vue | 21 ++++ src/components/table/table-head.vue | 32 ++++++ src/components/table/table.vue | 149 ++++++++++++++++++++++++++ src/components/transfer/search.vue | 1 + src/index.js | 2 + src/styles/components/table.less | 0 src/utils/assist.js | 12 +++ test/app.vue | 1 + test/main.js | 5 + test/routers/table.vue | 88 +++++++++++++++ 12 files changed, 334 insertions(+) create mode 100644 src/components/table/index.js create mode 100644 src/components/table/table-body.vue create mode 100644 src/components/table/table-column.vue create mode 100644 src/components/table/table-head.vue create mode 100644 src/components/table/table.vue create mode 100644 src/styles/components/table.less create mode 100644 test/routers/table.vue diff --git a/src/components/table/index.js b/src/components/table/index.js new file mode 100644 index 00000000..158c2e2d --- /dev/null +++ b/src/components/table/index.js @@ -0,0 +1,2 @@ +import Table from './table.vue'; +export default Table; \ No newline at end of file diff --git a/src/components/table/table-body.vue b/src/components/table/table-body.vue new file mode 100644 index 00000000..a0f797dd --- /dev/null +++ b/src/components/table/table-body.vue @@ -0,0 +1,21 @@ + + \ No newline at end of file diff --git a/src/components/table/table-column.vue b/src/components/table/table-column.vue new file mode 100644 index 00000000..a0f797dd --- /dev/null +++ b/src/components/table/table-column.vue @@ -0,0 +1,21 @@ + + \ No newline at end of file diff --git a/src/components/table/table-head.vue b/src/components/table/table-head.vue new file mode 100644 index 00000000..23ffcdc0 --- /dev/null +++ b/src/components/table/table-head.vue @@ -0,0 +1,32 @@ + + \ No newline at end of file diff --git a/src/components/table/table.vue b/src/components/table/table.vue new file mode 100644 index 00000000..aba33220 --- /dev/null +++ b/src/components/table/table.vue @@ -0,0 +1,149 @@ + + \ No newline at end of file diff --git a/src/components/transfer/search.vue b/src/components/transfer/search.vue index 544e4139..e795a91d 100644 --- a/src/components/transfer/search.vue +++ b/src/components/transfer/search.vue @@ -12,6 +12,7 @@ import iInput from '../input/input.vue'; export default { + components: { iInput }, props: { prefixCls: String, placeholder: String, diff --git a/src/index.js b/src/index.js index 0badbd70..fd0080a2 100644 --- a/src/index.js +++ b/src/index.js @@ -24,6 +24,7 @@ import Slider from './components/slider'; import Spin from './components/spin'; import Steps from './components/steps'; import Switch from './components/switch'; +import Table from './components/table'; import Tag from './components/tag'; import Timeline from './components/timeline'; import Tooltip from './components/tooltip'; @@ -69,6 +70,7 @@ const iview = { Step: Steps.Step, Steps, Switch, + iTable: Table, Tag, Timeline, TimelineItem: Timeline.Item, diff --git a/src/styles/components/table.less b/src/styles/components/table.less new file mode 100644 index 00000000..e69de29b diff --git a/src/utils/assist.js b/src/utils/assist.js index 334bd480..a6bf397f 100644 --- a/src/utils/assist.js +++ b/src/utils/assist.js @@ -75,4 +75,16 @@ export function getStyle (element, styleName) { } catch(e) { return element.style[styleName]; } +} + +// firstUpperCase +function firstUpperCase(str) { + return str.toString()[0].toUpperCase() + str.toString().slice(1); +} + +// Warn +export function warnProp(component, prop, correctType, wrongType) { + correctType = firstUpperCase(correctType); + wrongType = firstUpperCase(wrongType); + console.error(`[iView warn]: Invalid prop: type check failed for prop ${prop}. Expected ${correctType}, got ${wrongType}. (found in component: ${component})`); } \ No newline at end of file diff --git a/test/app.vue b/test/app.vue index 83855bdf..12d38274 100644 --- a/test/app.vue +++ b/test/app.vue @@ -41,6 +41,7 @@ li + li {
  • Input
  • Cascader
  • Transfer
  • +
  • Table
  • diff --git a/test/main.js b/test/main.js index 241e4d56..982ec29f 100644 --- a/test/main.js +++ b/test/main.js @@ -102,6 +102,11 @@ router.map({ component: function (resolve) { require(['./routers/transfer.vue'], resolve); } + }, + '/table': { + component: function (resolve) { + require(['./routers/table.vue'], resolve); + } } }); diff --git a/test/routers/table.vue b/test/routers/table.vue new file mode 100644 index 00000000..e8af2004 --- /dev/null +++ b/test/routers/table.vue @@ -0,0 +1,88 @@ + + \ No newline at end of file