drawer-navigation is the subelement of drawer, which is used to display the content of the drawer.
Item | Description |
|---|---|
Applicable devices | Mobile phones, tablets, and telematics devices |
Applicable regions | Global |
In addition to general attributes, the attribute listed in the following table is supported.
Parameter | Type | Default Value | Mandatory | Description |
|---|---|---|---|---|
direction | string | start | No | Swipe direction. The options are start and end. When a drawer element contains multiple draw-navigation elements, and their direction is set to the same value, only the one that sets the value first can take effect. |
Common styles are supported.
The width of drawer-navigation is specified by the width attribute in the common styles and has the maximum value (0.8 x width of the drawer) and minimum value (0.2 x width of drawer). The maximum value is the default value.
<template>
<drawer class="drawer" id="drawer" enableswipe="{{enableSwipe}}" onchange="onDrawerStateChanged" onscroll="onDrawerScroll">
<div class="content">
<input class="btn" type="button" value="Toggle enableswipe" onclick="toggleEnableSwipe" />
<input class="btn" type="button" value="Open Left" onclick="openLeft" />
<input class="btn" type="button" value="Open Right" onclick="openRight" />
<input class="btn" type="button" value="Open Default" onclick="openDefault" />
</div>
<drawer-navigation class="navigation" direction="start">
<input class="btn" type="button" value="Toggle enableswipe" onclick="toggleEnableSwipe" />
<input class="btn" type="button" value="Close Left" onclick="closeLeft" />
<input class="btn" type="button" value="Close Default" onclick="closeDefault" />
</drawer-navigation>
<drawer-navigation class="navigation" direction="end">
<input class="btn" type="button" value="Toggle enableswipe" onclick="toggleEnableSwipe" />
<input class="btn" type="button" value="Close Right" onclick="closeRight" />
</drawer-navigation>
</drawer>
</template>
<style>
.drawer {
width: 100%;
height: 100%;
}
.content {
background-color: #808080;
flex-direction: column;
align-items: center;
}
.btn {
width: 400px;
height: 100px;
margin: 16px;
background-color: #00bfff;
color: #ffffff;
}
.navigation {
width: 70%;
height: 100%;
background-color: #ffffff;
flex-direction: column;
align-items: center;
}
</style>
<script>
module.exports = {
data: {
enableSwipe: true
},
onDrawerStateChanged(params) {
console.log("change - direction:" + params.direction + " state:" + params.state);
},
onDrawerScroll(params) {
console.log("scroll - direction:" + params.direction + " slideOffset:" + params.slideOffset + " state:" + params.state);
},
toggleEnableSwipe() {
this.enableSwipe = !this.enableSwipe
},
openLeft() {
this.$element('drawer').openDrawer({ direction: 'start' })
},
openRight() {
this.$element('drawer').openDrawer({ direction: 'end' })
},
openDefault() {
this.$element('drawer').openDrawer()
},
closeLeft() {
this.$element('drawer').closeDrawer({ direction: 'start' })
},
closeRight() {
this.$element('drawer').closeDrawer({ direction: 'end' })
},
closeDefault() {
this.$element('drawer').closeDrawer()
},
}
</script>