From 17f52abf5b890be2869991f760dee239f8e35e43 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Tue, 6 Dec 2016 22:51:06 +0800 Subject: [PATCH] update Tabs --- src/components/tabs/pane.vue | 48 +++++++++++++++++++++++++++++++++++++++++++----- src/components/tabs/tabs.vue | 197 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- src/styles/components/tabs.less | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- test/app.vue | 1 + test/main.js | 5 +++++ test/routers/table.vue | 35 ++++++++++++++++++++++++++++------- test/routers/tabs.vue | 34 ++++++++++++++++++++++++++++++++++ 7 files changed, 508 insertions(+), 18 deletions(-) create mode 100644 test/routers/tabs.vue diff --git a/src/components/tabs/pane.vue b/src/components/tabs/pane.vue index f67cf44..0fda47b 100644 --- a/src/components/tabs/pane.vue +++ b/src/components/tabs/pane.vue @@ -1,13 +1,51 @@ \ No newline at end of file diff --git a/src/components/tabs/tabs.vue b/src/components/tabs/tabs.vue index f67cf44..b0255af 100644 --- a/src/components/tabs/tabs.vue +++ b/src/components/tabs/tabs.vue @@ -1,13 +1,200 @@ \ No newline at end of file diff --git a/src/styles/components/tabs.less b/src/styles/components/tabs.less index c5b0489..0e5ceb4 100644 --- a/src/styles/components/tabs.less +++ b/src/styles/components/tabs.less @@ -1 +1,205 @@ -@tabs-prefix-cls: ~"@{css-prefix}tabs"; \ No newline at end of file +@tabs-prefix-cls: ~"@{css-prefix}tabs"; + +.@{tabs-prefix-cls} { + box-sizing: border-box; + position: relative; + overflow: hidden; + color: @text-color; + .clearfix; + + &-bar { + outline: none; + } + + &-ink-bar { + height: 2px; + box-sizing: border-box; + background-color: @primary-color; + position: absolute; + left: 0; + bottom: 1px; + z-index: 1; + transition: transform .3s @ease-in-out; + transform-origin: 0 0; + } + + &-bar { + border-bottom: 1px solid @border-color-base; + margin-bottom: 16px; + } + + &-nav-container { + margin-bottom: -1px; + line-height: @line-height-base; + font-size: @font-size-base; + box-sizing: border-box; + white-space: nowrap; + overflow: hidden; + position: relative; + .clearfix; + } + + &-nav-container-scrolling { + padding-left: 32px; + padding-right: 32px; + } + + &-nav-wrap { + overflow: hidden; + margin-bottom: -1px; + } + + &-nav-scroll { + overflow: hidden; + white-space: nowrap; + } + + &-nav { + padding-left: 0; + margin: 0; + float: left; + list-style: none; + box-sizing: border-box; + position: relative; + transition: transform 0.5s @ease-in-out; + + &:before, + &:after { + display: table; + content: " "; + } + + &:after { + clear: both; + } + + .@{tabs-prefix-cls}-tab-disabled { + pointer-events: none; + cursor: default; + color: #ccc; + } + + .@{tabs-prefix-cls}-tab { + display: inline-block; + height: 100%; + padding: 8px 16px; + margin-right: 16px; + box-sizing: border-box; + cursor: pointer; + text-decoration: none; + position: relative; + transition: color .3s @ease-in-out; + + &:hover { + color: @link-hover-color; + } + + &:active { + color: @link-active-color; + } + .@{css-prefix-iconfont} { + width: 14px; + height: 14px; + margin-right: 8px; + } + } + + .@{tabs-prefix-cls}-tab-active { + color: @primary-color; + } + } + &-mini &-nav-container { + font-size: @font-size-base; + } + + &-mini &-tab { + margin-right: 0; + padding: 8px 16px; + } + + & { + .@{tabs-prefix-cls}-content-animated { + display: flex; + flex-direction: row; + will-change: transform; + transition: transform .3s @ease-in-out; + } + + .@{tabs-prefix-cls}-tabpane { + flex-shrink: 0; + width: 100%; + transition: opacity .3s; + opacity: 1; + } + + .@{tabs-prefix-cls}-tabpane-inactive { + opacity: 0; + height: 0; + } + } + + // card style + &&-card > &-bar &-nav-container { + height: 32px; + } + &&-card > &-bar &-ink-bar { + visibility: hidden; + } + &&-card > &-bar &-tab { + margin: 0; + margin-right: 4px; + height: 31px; + padding: 5px 16px 4px; + border: 1px solid @border-color-base; + border-bottom: 0; + border-radius: @btn-border-radius @btn-border-radius 0 0; + transition: all 0.3s @ease-in-out; + background: @table-thead-bg; + } + &&-card > &-bar &-tab-active { + height: 32px; + padding-bottom: 5px; + background: #fff; + transform: translateZ(0); + border-color: @border-color-base; + color: @primary-color; + } + &&-card > &-bar &-nav-wrap { + margin-bottom: 0; + } + &&-card > &-bar &-tab .@{css-prefix-iconfont}-ios-close-empty { + width: 0; + height: 22px; + font-size: 22px; + margin-right: 0; + color: @legend-color; + text-align: right; + vertical-align: middle; + overflow: hidden; + position: relative; + top: -1px; + transform-origin: 100% 50%; + transition: all 0.3s @ease-in-out; + &:hover { + color: #444; + } + } + + &&-card > &-bar &-tab-active .@{css-prefix-iconfont}-ios-close-empty, + &&-card > &-bar &-tab:hover .@{css-prefix-iconfont}-ios-close-empty { + width: 14px; + transform: translateZ(0); + } +} + +.@{tabs-prefix-cls}-no-animation{ + .@{tabs-prefix-cls}-content { + &-animated { + transform: none!important; + } + + > .@{tabs-prefix-cls}-tabpane-inactive { + display: none; + } + } +} \ No newline at end of file diff --git a/test/app.vue b/test/app.vue index 3d6a6a9..fc1611a 100644 --- a/test/app.vue +++ b/test/app.vue @@ -43,6 +43,7 @@ li + li {
  • Transfer
  • Table
  • Dropdown
  • +
  • Tabs
  • diff --git a/test/main.js b/test/main.js index c572d57..1b1729f 100644 --- a/test/main.js +++ b/test/main.js @@ -112,6 +112,11 @@ router.map({ component: function (resolve) { require(['./routers/dropdown.vue'], resolve); } + }, + '/tabs': { + component: function (resolve) { + require(['./routers/tabs.vue'], resolve); + } } }); diff --git a/test/routers/table.vue b/test/routers/table.vue index 48ef875..4d7b389 100644 --- a/test/routers/table.vue +++ b/test/routers/table.vue @@ -1,17 +1,18 @@ diff --git a/test/routers/tabs.vue b/test/routers/tabs.vue new file mode 100644 index 0000000..44e4ba9 --- /dev/null +++ b/test/routers/tabs.vue @@ -0,0 +1,34 @@ + + \ No newline at end of file -- libgit2 0.21.4