Files
zb-table/components/u-header.vue

123 lines
2.5 KiB
Vue
Raw Normal View History

2022-04-14 17:08:57 +08:00
<template>
<view class="m-header">
<view class="m-layout-header">
2022-04-15 10:50:06 +08:00
<uni-icons
class="icons-left"
type="list" size="30" @click="showMenu"></uni-icons>
2022-04-18 09:42:54 +08:00
<!-- #ifdef APP-NVUE || H5 -->
<view class="title">
{{title}}
</view>
<!-- #endif -->
2022-04-14 17:08:57 +08:00
</view>
2022-04-15 10:50:06 +08:00
<zb-drawer mode="left"
2022-04-14 17:08:57 +08:00
title="组件"
width="60%" :visible.sync="isShowDrawer" >
<view class="drawer_content">
2022-04-15 10:31:06 +08:00
<view class="item" @click="goTo('/pages/table/index')">表格组件</view>
2022-04-15 10:50:06 +08:00
<view class="item" @click="goTo('/pages/pagination/pagination')">分页组件</view>
2022-04-15 10:31:06 +08:00
<view class="item" @click="goTo('/pages/drawer/drawer')">抽屉组件</view>
2022-04-14 17:08:57 +08:00
</view>
</zb-drawer>
</view>
</template>
<script>
export default{
data(){
return {
isShowDrawer:false
}
},
2022-04-15 10:50:06 +08:00
computed:{
title(){
let obj = {
'/pages/table/index':'zb-table',
'/pages/pagination/pagination':'zb-pagination',
'/pages/pagination/drawer':'zb-drawer',
}
2022-04-18 09:42:54 +08:00
// #ifdef APP-NVUE || H5
2022-04-15 10:50:06 +08:00
return obj[this.$page.path]
2022-04-18 09:42:54 +08:00
// #endif
return ''
2022-04-15 10:50:06 +08:00
}
},
2022-04-14 17:08:57 +08:00
mounted(){
2022-04-15 10:50:06 +08:00
// console.log(getCu)
// console.log('===',this.$page.path)
2022-04-14 17:08:57 +08:00
// uni.navigateTo({
// url: `/pages/table/index`,
// animationType: 'slide-in-right',
// animationDuration: 2000,
// });
},
2022-04-15 10:50:06 +08:00
onLoad(e){
console.log('===',this.$mp.page.route)
},
2022-04-14 17:08:57 +08:00
methods:{
goTo(url){
this.isShowDrawer = false
setTimeout(()=>{
uni.navigateTo({
url,
animationType: 'slide-in-right',
animationDuration: 2000,
});
},300)
2022-04-15 10:50:06 +08:00
2022-04-14 17:08:57 +08:00
},
showMenu(){
this.isShowDrawer = true
}
}
}
2022-04-15 10:50:06 +08:00
</script>
2022-04-15 10:31:06 +08:00
<style lang="scss" scoped>
2022-04-14 17:08:57 +08:00
.m-header{
/* position: absolute; */
/* right: 0; */
/* bottom: 0; */
/* left: 0; */
top: 0;
}
2022-04-15 10:50:06 +08:00
.icons-left{
position: absolute;
left: 8px;
}
2022-04-14 17:08:57 +08:00
.m-layout-header{
height: 80rpx;
2022-04-15 10:50:06 +08:00
position: relative;
2022-04-14 17:08:57 +08:00
background-color: white;
display: flex;
flex-direction: row;
padding-left: 8px;
padding-right: 8px;
2022-04-15 10:50:06 +08:00
justify-content: center;
2022-04-14 17:08:57 +08:00
align-items: center;
2022-04-15 10:50:06 +08:00
.title{
font-weight: bold;
}
2022-04-14 17:08:57 +08:00
}
2022-04-15 10:31:06 +08:00
.drawer_content{
padding-left: 8px;
padding-right: 8px;
.item{
overflow: hidden;
color: #808080;
font-size: 32rpx;
height: 80rpx;
text-overflow: ellipsis;
word-wrap: normal;
white-space: nowrap;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
}
2022-04-15 10:50:06 +08:00
</style>