Skip to content

Commit

Permalink
feat: 初始化日历界面
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhenfei committed Jul 17, 2020
1 parent cb657f8 commit b26e8ca
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 9 deletions.
14 changes: 14 additions & 0 deletions components/pi-calender/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<view>日历</view>
</template>

<script>
import ValueSync from '../../mixin/value-sync'
import { getConfig } from '../../config'
const TAG = 'PiMask'
const { calender } = getConfig()
export default {}
</script>

<style></style>
38 changes: 29 additions & 9 deletions components/pi-navbar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,43 @@
<view v-if="fixed" class="pi-w-100P" :style="{ height: statusBarHeight }" />
<!-- 真正渲染的navbar -->
<view class="pi-rela pi-w-100P pi-align-center" :style="{ height: height }">
<!-- 左侧 -->
<view class="pi-abso-left-center pi-align-center">
<view v-if="showBack" class="pi-align-center" @tap="handleGoBack">
<view
:class="'pi-icon-' + backIconName"
:style="{ color: backIconColor, padding: backIconPadding, fontSize: backIconSize }"
/>
<view v-if="backText" :style="backTextStyle">{{ backText }}</view>
</view>
<slot v-if="$slots.left" name="left" />
<template v-else>
<view v-if="showBack && isShowBack" class="pi-align-center" @tap="handleGoBack">
<view
:class="'pi-icon-' + backIconName"
:style="{ color: backIconColor, padding: backIconPadding, fontSize: backIconSize }"
/>
<view v-if="backText" :style="backTextStyle">{{ backText }}</view>
</view>
</template>
<view v-if="showHome" class="pi-align-center" @tap="handleGoHome">
<view
:class="'pi-icon-' + homeIconName"
:style="{ color: homeIconColor, padding: homeIconPadding, fontSize: homeIconSize }"
/>
</view>
</view>
<!-- 标题 -->
<view :style="[navTitleStyle]" class=" pi-flex-sub pi-text-center">
<block v-if="title">{{ title }}</block>
<!-- slot default -->
<slot v-else />
</view>
<!-- slot right -->
<!-- 右侧 -->
<view class="pi-abso-right-center"><slot name="right" /></view>
</view>
</view>
</view>
</template>

<script>
/**
* 返回按钮内部已经做了处理,如果当前打开页面不属于二级页面,则不显示,需要显示左侧内容,请使用 slot left
* slot left 和 backIcon homeIcon 冲突,两者只能取其一,默认以slot left为主
*/
import { systemInfo } from '../../tools/system'
import * as navi from '../../tools/navi'
import { getConfig } from '../../config'
Expand Down Expand Up @@ -172,7 +181,9 @@ export default {
}
},
data() {
return {}
return {
isShowBack: false
}
},
computed: {
// 状态栏高度
Expand All @@ -192,7 +203,16 @@ export default {
return this.titleStyle
}
},
created() {
this.syncPageRoute()
},
methods: {
syncPageRoute() {
/* eslint-disable */
const pages = getCurrentPages()
// 如果堆栈大于1表示打开了子页面,需要显示返回按钮
this.isShowBack = pages.length > 1
},
handleGoBack() {
// 如果自定义了点击返回按钮的函数,则执行,否则执行返回逻辑
if (this.customBackFunc && typeof this.customBackFunc === 'function') {
Expand Down
1 change: 1 addition & 0 deletions config/calender.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {}

0 comments on commit b26e8ca

Please sign in to comment.