Commit 1fc53c45 authored by 李俊赕's avatar 李俊赕

样式优化1

parent 306e8e1d
......@@ -2,33 +2,38 @@
<div class="main">
<section class="page-container">
<div class="menu-wrapper" ref="menu">
<div :class="['menu-item',currentMenuIndex===menuIndex ? 'active' : '']" v-for="(menu,menuIndex) in 50" :key="menuIndex" @click="changeMenu(menu,menuIndex)">
menu{{menuIndex}}
<div class="content">
<div :class="['menu-item',currentMenuIndex===menuIndex ? 'active' : '']" v-for="(menu,menuIndex) in menuList" :key="menuIndex" @click="changeMenu(menu,menuIndex)">
{{menu}}
</div>
</div>
</div>
<div class="container-wrapper" ref="container">
<template v-for="(item,itemIndex) in formList">
<div :key="itemIndex" class="content-box">
<div class="title">
{{item.title}}
</div>
<div class="form-content">
<template v-for="(contentItem,contentIndex) in item.content" >
<component
:key="contentIndex"
:item="contentItem"
:is="contentItem.inputType | typeToComponentName"
/>
</template>
<div class="content">
<template v-for="(item,itemIndex) in formList">
<div :key="itemIndex" class="content-box">
<div class="title">
{{item.title}}
</div>
<div class="form-content">
<template v-for="(contentItem,contentIndex) in item.content" >
<component
:key="contentIndex"
:item="contentItem"
:is="contentItem.inputType | typeToComponentName"
/>
</template>
<!-- <xh-input /> -->
</div>
</div>
</template>
<div class="btn-group">
<mt-button type="primary" size="small" :plain="true">保存</mt-button>
<mt-button type="primary" size="small">提交信息</mt-button>
</div>
</template>
</div>
<div class="btn-group">
<mt-button type="primary" size="small" :plain="true">保存</mt-button>
<mt-button type="primary" size="small">提交信息</mt-button>
</div>
</div>
</section>
</div>
</template>
......@@ -67,6 +72,7 @@ export default {
scrollContent: null,
scrollY: 0,
formList: [],
menuList: [],
inApp: true,
loading: true,
orderId: '',
......@@ -153,11 +159,15 @@ export default {
methods: {
initPageData() {
const query = this.$route.query
console.log(query, 'query')
const { type } = query
this.type = type
this.formList = getData(type)
this.initScroll()
this.formList.map(item => {
this.menuList.push(item.title)
})
this.$nextTick(() => {
this.initScroll()
})
},
changeMenu(item, index) {
this.currentMenuIndex = index
......@@ -166,25 +176,30 @@ export default {
)
const el = contentBox[index]
this.currentTime = new Date().getTime()
console.log(contentBox, 'contentBox')
this.scrollContent.scrollToElement(el, 0)
},
initScroll() {
// this.srcollMenu = new BScroll(this.$refs.menu, {
// probeType: 3,
// scrollX: true,
// scrollY: false,
// startX: 0,
// eventPassthrough: 'vertical',
// click: true
// })
console.log(this.$refs, 'refs')
this.scrollContent = new BScroll(this.$refs.container, {
probeType: 3,
click: true
})
this.scrollContent.on('scroll', pos => {
console.log(pos, 'pos')
this.scrollY = Math.abs(Math.round(pos.y))
})
this.$nextTick(() => {
this._calculateHeight()
})
this.calculateHeight()
},
_calculateHeight() {
calculateHeight() {
const contentBox = this.$refs.container.getElementsByClassName(
'content-box'
)
......@@ -274,17 +289,27 @@ export default {
// display: flex;
}
.menu-wrapper{
display: flex;
overflow: auto;
position: relative;
z-index: 10;
width:100%;
background: #fff;
.content{
display: flex;
overflow: auto;
}
.menu-item{
flex:1;
// flex:1;
white-space: nowrap;
font-weight: bold;
padding:px2rem(30) px2rem(40);
}
.menu-item.active{
border-bottom:px2rem(2) solid #26a2ff ;
border-bottom:px2rem(6) solid #26a2ff ;
}
}
.container-wrapper{
height:calc(100vh - 100px);
// overflow: auto;
width:100%;
border-radius:px2rem(10) ;
padding:px2rem(20);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment