Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
If the drawer element is used, the drawer is not displayed by default. You can swipe from the screen side or call an API to display it. The flex layout is supported.
Item | Description |
|---|---|
Applicable devices | Mobile phones, tablets, and telematics devices |
Applicable regions | Global |
Subelements are supported, for example, the drawer-navigation element.
In addition to general attributes, the attribute listed in the following table is supported.
Attribute | Type | Default Value | Mandatory | Description |
|---|---|---|---|---|
enableswipe | boolean | true | No | Controls whether the drawer can be opened or closed by swiping. This feature is enabled by default. |
Common styles are supported.
In addition to common events, the events listed in the following table are supported.
Event | Parameter | Description |
|---|---|---|
change | {direction:directionValue, state: stateValue} | Callback upon the drawer opening or closing.
|
scroll | {direction:directionValue, slideOffset:offsetValue, state:stateValue} | Event callback upon drawer scrolling.
|
Method | Parameter | Description |
|---|---|---|
openDrawer | object | Opens the drawer in the specified position. |
closeDrawer | object | Closes the drawer in the specified position. |
openDrawer parameters
Parameter | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
direction | string | No | - | The value can be start or end. If the value of direction is not set, and there exists only one drawer-navigation, the drawer-navigation is opened by default. If the left draw-navigation and right draw-navigation both exist, the left draw-navigation is opened by default. This parameter does not take effect when the specified value does not match the value of direction in drawer-navigation. |
closeDrawer parameters
Parameter | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
direction | string | No | - | The value can be start or end. If the value of direction is not set, and there exists only one drawer-navigation, the drawer-navigation is closed by default. If the left draw-navigation and right draw-navigation both exist, the value of direction must be specified. This parameter does not take effect when the specified value does not match the value of direction in drawer-navigation. |
- <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>
Version | Date | Description |
|---|---|---|
1080 | 2021-12-28 | First official release. |