style:refine tabsview css
This commit is contained in:
parent
2c868f47d9
commit
d56831679e
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<a href="https://github.com/PanJiaChen/vue-element-admin" target="_blank" class="github-corner" aria-label="View source on Github">
|
<a href="https://github.com/PanJiaChen/vue-element-admin" target="_blank" class="github-corner" aria-label="View source on Github">
|
||||||
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#4AB7BD; color:#fff; position: absolute; top: 50px; border: 0; right: 0;"
|
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#4AB7BD; color:#fff; position: absolute; top: 84px; border: 0; right: 0;"
|
||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
|
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
|
||||||
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
|
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<template>
|
||||||
|
<div class='scroll-container' ref='scrollContainer' @mousewheel="handleScroll">
|
||||||
|
<div class='scroll-wrapper' ref='scrollWrapper' :style="{left: left + 'px'}">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'scrollPane',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
left: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleScroll(e) {
|
||||||
|
e.preventDefault()
|
||||||
|
const $container = this.$refs.scrollContainer
|
||||||
|
const $containerWidth = $container.offsetWidth
|
||||||
|
const $wrapper = this.$refs.scrollWrapper
|
||||||
|
const $wrapperWidth = $wrapper.offsetWidth
|
||||||
|
console.log($containerWidth, $wrapperWidth)
|
||||||
|
if (e.wheelDelta > 0) {
|
||||||
|
this.left = Math.min(0, this.left + e.wheelDelta)
|
||||||
|
} else {
|
||||||
|
if ($containerWidth - 100 < $wrapperWidth) {
|
||||||
|
if (this.left < -($wrapperWidth - $containerWidth + 100)) {
|
||||||
|
this.left = this.left
|
||||||
|
} else {
|
||||||
|
this.left = Math.max(this.left + e.wheelDelta, $containerWidth - $wrapperWidth - 100)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.left = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
.scroll-container {
|
||||||
|
white-space: nowrap;
|
||||||
|
position: relative;
|
||||||
|
.scroll-wrapper {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -4,6 +4,7 @@
|
||||||
@import './sidebar.scss';
|
@import './sidebar.scss';
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
height: 100%;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
|
@ -15,9 +16,14 @@ label {
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
|
height: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#app{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
*,
|
*,
|
||||||
*:before,
|
*:before,
|
||||||
*:after {
|
*:after {
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
<router-link class="pan-btn pink-btn" to="/excel/download">Excel</router-link>
|
<router-link class="pan-btn pink-btn" to="/excel/download">Excel</router-link>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4" class='text-center'>
|
<el-col :span="4" class='text-center'>
|
||||||
<router-link class="pan-btn green-btn" to="/example/table/table">Table</router-link>
|
<router-link class="pan-btn green-btn" to="/example/table/complex-table">Table</router-link>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4" class='text-center'>
|
<el-col :span="4" class='text-center'>
|
||||||
<router-link class="pan-btn tiffany-btn" to="/example/form/edit">Form</router-link>
|
<router-link class="pan-btn tiffany-btn" to="/form/edit-form">Form</router-link>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4" class='text-center'>
|
<el-col :span="4" class='text-center'>
|
||||||
<router-link class="pan-btn yellow-btn" to="/theme/index">Theme</router-link>
|
<router-link class="pan-btn yellow-btn" to="/theme/index">Theme</router-link>
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<div class='tabs-view-container'>
|
<scroll-pane class='tabs-view-container'>
|
||||||
<router-link class="tabs-view-item" :class="isActive(tag.path)?'active':''" v-for="tag in Array.from(visitedViews)" :to="tag.path" :key="tag.path">
|
<router-link class="tabs-view-item" :class="isActive(tag.path)?'active':''" v-for="tag in Array.from(visitedViews)" :to="tag.path"
|
||||||
{{tag.name}}
|
:key="tag.path">
|
||||||
<span class='el-icon-close' @click='closeViewTabs(tag,$event)'></span>
|
{{tag.name}}
|
||||||
|
<span class='el-icon-close' @click='closeViewTabs(tag,$event)'></span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</scroll-pane>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import ScrollPane from '@/components/ScrollPane'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: { ScrollPane },
|
||||||
computed: {
|
computed: {
|
||||||
visitedViews() {
|
visitedViews() {
|
||||||
return this.$store.state.app.visitedViews
|
return this.$store.state.app.visitedViews
|
||||||
|
@ -44,6 +49,7 @@ export default {
|
||||||
isActive(path) {
|
isActive(path) {
|
||||||
return path === this.$route.path
|
return path === this.$route.path
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route() {
|
$route() {
|
||||||
|
@ -57,25 +63,25 @@ export default {
|
||||||
.tabs-view-container {
|
.tabs-view-container {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
height: 34px;
|
height: 34px;
|
||||||
line-height: 34px;
|
|
||||||
border-bottom: 1px solid #d8dce5;
|
border-bottom: 1px solid #d8dce5;
|
||||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .12), 0 0 6px 0 rgba(0, 0, 0, .04);
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
|
||||||
.tabs-view-item {
|
.tabs-view-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 32px;
|
height: 26px;
|
||||||
line-height: 32px;
|
line-height: 26px;
|
||||||
border: 1px solid #d8dce5;
|
border: 1px solid #d8dce5;
|
||||||
color: #495060;
|
color: #495060;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 0 12px;
|
padding: 0 8px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-left: 10px;
|
margin-left: 5px;
|
||||||
|
margin-top: 4px;
|
||||||
&:first-of-type {
|
&:first-of-type {
|
||||||
margin-left: 0px;
|
margin-left: 15px;
|
||||||
}
|
}
|
||||||
&.active {
|
&.active {
|
||||||
border-bottom: 0px;
|
background-color: #eef1f6;
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
background: #20a0ff;
|
background: #20a0ff;
|
||||||
|
|
Loading…
Reference in New Issue