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

样式优化1

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