|
| 1 | +# <wxc-navpage> |
| 2 | + |
| 3 | +### Summary |
| 4 | + |
| 5 | +The "wxc-navpage" tag implements a specialized component that contains a navbar at the top of the window and an embed content page. You can customize the navbar as you like. In addition, you can use `navigator` module to control the page jump, see [navigator module](../modules/navigator.md). |
| 6 | + |
| 7 | +### Child Components |
| 8 | + |
| 9 | +This type of component supports all kinds of weex component as its child components. |
| 10 | + |
| 11 | +### Attributes |
| 12 | + |
| 13 | +- `height`: <length> The height of the navbar. Default value is 88. |
| 14 | +- `background-color`: <color>The backgroudColor of the navbar. Default value is `white`. |
| 15 | +- `title`: <string> The title of the navbar. |
| 16 | +- `title-color`: <color>The color of the navbar title. Default value is `black`. |
| 17 | +- `left-item-title`: <string> The title of the leftItem. |
| 18 | +- `left-item-color`: <color> The color of the leftItem title. Default value is `black`. |
| 19 | +- `right-item-title`: <string> The title of the rightItem. |
| 20 | +- `right-item-color`: <color> The color of the rightItem title. Default value is `black`. |
| 21 | +- `left-item-src`: <string> The imageURL of the leftItem you want to set. |
| 22 | +- `right-item-src`: <string> The imageURL of the rightItem you want to set. |
| 23 | + |
| 24 | +Other attributes please check out the [common attributes](../references/common-attrs.md). |
| 25 | + |
| 26 | +### Styles |
| 27 | + |
| 28 | +**common styles**: check out the [common styles](../references/common-attrs.md) |
| 29 | + |
| 30 | +- support flexbox related styles |
| 31 | +- support box model related styles |
| 32 | +- support ``position`` related styles |
| 33 | +- support ``opacity``, ``background-color`` etc. |
| 34 | + |
| 35 | +### Events |
| 36 | + |
| 37 | +- `naviBar.leftItem.click`: triggered when the leftItem of navbar is clicked. You need to register the observer in ready or create block. |
| 38 | +- `naviBar.rightItem.click`: triggered when the rightItem of navbar is clicked. You need to register the observer in ready or create block. |
| 39 | + |
| 40 | +**common events**: check out the [common events](../references/common-event.md) |
| 41 | + |
| 42 | +- support `click` event. Check out [common events](../references/common-event.md) |
| 43 | +- support `appear` / `disappear` event. Check out [common events](../references/common-event.md) |
| 44 | + |
| 45 | +### Example |
| 46 | + |
| 47 | +```js |
| 48 | +<template> |
| 49 | + <wxc-navpage height={{...}} background-color="..." title="..." title-color="..." left-item-title="..." left-item-color="..." right-item-src="..."> |
| 50 | + <content> ...</content> |
| 51 | + </wxc-navpage> |
| 52 | +</template> |
| 53 | +<script> |
| 54 | + require('weex-components'); |
| 55 | + module.exports = { |
| 56 | + created: function() { |
| 57 | + this.$on('naviBar.rightItem.click',function(e){ |
| 58 | + //handle your click event here. |
| 59 | + }); |
| 60 | + |
| 61 | + this.$on('naviBar.leftItem.click',function(e){ |
| 62 | + //handle your click event here. |
| 63 | + }); |
| 64 | + } |
| 65 | + } |
| 66 | +</script> |
| 67 | +``` |
| 68 | + |
| 69 | + |
0 commit comments