[Improvement] NavBar: add zIndex prop (#525)

This commit is contained in:
neverland 2018-01-10 14:37:59 +08:00 committed by GitHub
parent 0bb1fe69a3
commit a6dc2912ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View File

@ -52,6 +52,7 @@ export default {
| right-text | Right Text | `String` | `''` | - |
| left-arrow | Whether to show left arrow | `Boolean` | `false` | - |
| fixed | Whether to fixed top | `Boolean` | `false` | - |
| z-index | Z-index | `Number` | `1` | - |
### Slot

View File

@ -53,6 +53,7 @@ export default {
| right-text | 右侧文案 | `String` | `''` | - |
| left-arrow | 是否显示左侧箭头 | `Boolean` | `false` | - |
| fixed | 是否固定在顶部 | `Boolean` | `false` | - |
| z-index | 元素 z-index | `Number` | `1` | - |
### Slot

View File

@ -1,5 +1,9 @@
<template>
<div class="van-nav-bar van-hairline--top-bottom" :class="{ 'van-nav-bar--fixed': fixed }">
<div
class="van-nav-bar van-hairline--top-bottom"
:class="{ 'van-nav-bar--fixed': fixed }"
:style="style"
>
<div class="van-nav-bar__left" @click="$emit('click-left')">
<slot name="left">
<icon v-if="leftArrow" class="van-nav-bar__arrow" name="arrow" />
@ -28,7 +32,19 @@ export default create({
leftText: String,
rightText: String,
leftArrow: Boolean,
fixed: Boolean
fixed: Boolean,
zIndex: {
type: Number,
default: 1
}
},
computed: {
style() {
return {
zIndex: this.zIndex
};
}
}
});
</script>