提交 ab8325ce 编写于 作者: Q qiang

fix: 修复 H5 navigationBarShadow 配置不生效的问题 fixed #607

上级 f3a52261
<template> <template>
<uni-page :data-page="$route.meta.pagePath"> <uni-page :data-page="$route.meta.pagePath">
<page-head <page-head
v-if="navigationBar.type!=='none'" v-if="navigationBar.type!=='none'"
v-bind="navigationBar" /> v-bind="navigationBar" />
<page-refresh <page-refresh
v-if="enablePullDownRefresh" v-if="enablePullDownRefresh"
ref="refresh" ref="refresh"
:color="refreshOptions.color" :color="refreshOptions.color"
:offset="refreshOptions.offset" /> :offset="refreshOptions.offset"
<page-body />
v-if="enablePullDownRefresh" <page-body
@touchstart.native="_touchstart" v-if="enablePullDownRefresh"
@touchstart.native="_touchstart"
@touchmove.native="_touchmove" @touchmove.native="_touchmove"
@touchend.native="_touchend" @touchend.native="_touchend"
@touchcancel.native="_touchend"> @touchcancel.native="_touchend"
>
<slot name="page" /> <slot name="page" />
</page-body> </page-body>
<page-body v-else> <page-body v-else>
...@@ -22,11 +24,11 @@ ...@@ -22,11 +24,11 @@
</uni-page> </uni-page>
</template> </template>
<style> <style>
uni-page { uni-page {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
<script> <script>
import { import {
...@@ -146,6 +148,12 @@ export default { ...@@ -146,6 +148,12 @@ export default {
titlePenetrate: { titlePenetrate: {
type: String, type: String,
default: 'NO' default: 'NO'
},
navigationBarShadow: {
type: Object,
default () {
return {}
}
} }
}, },
data () { data () {
...@@ -180,6 +188,7 @@ export default { ...@@ -180,6 +188,7 @@ export default {
timingFunc: '', timingFunc: '',
titlePenetrate: yesNoParseList[this.titlePenetrate] titlePenetrate: yesNoParseList[this.titlePenetrate]
}, titleNView) }, titleNView)
navigationBar.shadow = this.navigationBarShadow
const refreshOptions = Object.assign({ const refreshOptions = Object.assign({
support: true, support: true,
...@@ -223,4 +232,4 @@ export default { ...@@ -223,4 +232,4 @@ export default {
} }
} }
} }
</script> </script>
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
<uni-page-head :uni-page-head-type="type"> <uni-page-head :uni-page-head-type="type">
<div <div
:style="{transitionDuration:duration,transitionTimingFunction:timingFunc,backgroundColor:bgColor,color:textColor}" :style="{transitionDuration:duration,transitionTimingFunction:timingFunc,backgroundColor:bgColor,color:textColor}"
:class="{'uni-page-head-transparent':type==='transparent','uni-page-head-titlePenetrate': titlePenetrate}" :class="headClass"
class="uni-page-head" class="uni-page-head"
> >
<div class="uni-page-head-hd"> <div class="uni-page-head-hd">
<div <div
v-show="backButton" v-show="backButton"
class="uni-page-head-btn" class="uni-page-head-btn"
@click="_back"> @click="_back">
<i <i
:style="{color:color,fontSize:'27px'}" :style="{color:color,fontSize:'27px'}"
class="uni-btn-icon">&#xe601;</i> class="uni-btn-icon">&#xe601;</i>
</div> </div>
<template v-for="(btn,index) in btns"> <template v-for="(btn,index) in btns">
...@@ -32,19 +32,19 @@ ...@@ -32,19 +32,19 @@
</div> </div>
</template> </template>
</div> </div>
<div <div
v-if="!searchInput" v-if="!searchInput"
class="uni-page-head-bd"> class="uni-page-head-bd">
<div <div
:style="{fontSize:titleSize,opacity:type==='transparent'?0:1}" :style="{fontSize:titleSize,opacity:type==='transparent'?0:1}"
class="uni-page-head__title" class="uni-page-head__title"
> >
<i <i
v-if="loading" v-if="loading"
class="uni-loading" /> class="uni-loading" />
<img <img
v-if="titleImage!==''" v-if="titleImage!==''"
:src="titleImage" :src="titleImage"
class="uni-page-head__title_image" > class="uni-page-head__title_image" >
<template v-else>{{ titleText }}</template> <template v-else>{{ titleText }}</template>
</div> </div>
...@@ -108,7 +108,7 @@ uni-page-head { ...@@ -108,7 +108,7 @@ uni-page-head {
uni-page-head .uni-page-head { uni-page-head .uni-page-head {
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 44px; height: 44px;
...@@ -302,6 +302,44 @@ uni-page-head .uni-page-head__title .uni-page-head__title_image { ...@@ -302,6 +302,44 @@ uni-page-head .uni-page-head__title .uni-page-head__title_image {
height: 26px; height: 26px;
vertical-align: middle; vertical-align: middle;
} }
uni-page-head .uni-page-head-shadow {
overflow: visible;
}
uni-page-head .uni-page-head-shadow::after {
content: "";
position: absolute;
left: 0;
right: 0;
top: 100%;
height: 5px;
background-size: 100% 100%;
}
uni-page-head .uni-page-head-shadow-grey::after {
background-image: url("https://cdn.dcloud.net.cn/img/shadow-grey.png");
}
uni-page-head .uni-page-head-shadow-blue::after {
background-image: url("https://cdn.dcloud.net.cn/img/shadow-blue.png");
}
uni-page-head .uni-page-head-shadow-green::after {
background-image: url("https://cdn.dcloud.net.cn/img/shadow-green.png");
}
uni-page-head .uni-page-head-shadow-orange::after {
background-image: url("https://cdn.dcloud.net.cn/img/shadow-orange.png");
}
uni-page-head .uni-page-head-shadow-red::after {
background-image: url("https://cdn.dcloud.net.cn/img/shadow-red.png");
}
uni-page-head .uni-page-head-shadow-yellow::after {
background-image: url("https://cdn.dcloud.net.cn/img/shadow-yellow.png");
}
</style> </style>
<script> <script>
import appendCss from 'uni-platform/helpers/append-css' import appendCss from 'uni-platform/helpers/append-css'
...@@ -385,6 +423,12 @@ export default { ...@@ -385,6 +423,12 @@ export default {
titlePenetrate: { titlePenetrate: {
type: Boolean, type: Boolean,
default: false default: false
},
shadow: {
type: Object,
default () {
return {}
}
} }
}, },
data () { data () {
...@@ -425,6 +469,18 @@ export default { ...@@ -425,6 +469,18 @@ export default {
}) })
} }
return btns return btns
},
headClass () {
const shadowColorType = this.shadow.colorType
const data = {
'uni-page-head-transparent': this.type === 'transparent',
'uni-page-head-titlePenetrate': this.titlePenetrate,
'uni-page-head-shadow': shadowColorType
}
if (shadowColorType) {
data[`uni-page-head-shadow-${shadowColorType}`] = shadowColorType
}
return data
} }
}, },
mounted () { mounted () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册