@hippy4tv/vue-native-components
Version:
Hippy Vue Native components for TV
83 lines (60 loc) • 2.46 kB
Markdown
# Hippy Vue Native Components
> The package contains the **Native only** components provide by Hippy.
> For web alternative could use `hippy-vue-web-components`(it's not exist yet).

## How to use
### Install
Install with tnpm.
```bash
tnpm install hippy-vue-native-components
```
### Register components with the middleware
#### 1. Register all of components
Point to the native entry, import the middleware
```javascript
import HippyVueNativeComponents from 'hippy-vue-native-components';
```
And use the middleware
```javascript
Vue.use(HippyVueNativeComponents);
```
#### 2. Register specific component
Dialog component as the example, point to the native entry, import the specific middleware.
for more reigster, see the `Register Middleware` column in `Supported native components` table.
```javascript
import { ModalComponent } from 'hippy-vue-native-components';
```
And use the middleware
```javascript
Vue.use(ModalComponent);
```
### Template usage
#### Dialog component as the example
```javascript
<template>
<dialog
animationType="slide"
class="dialog-demo"
:supportedOrientations="supportedOrientations"
v-if="dialogIsVisible"
="onShow"
="onClose">
<div class="dialog-demo-wrapper">
<div class="fullscreen center row">
<button ="clickView" class="dialog-demo-close-btn center row">
<p class="dialog-demo-close-btn-text">Close</p>
</button>
</div>
</div>
</dialog>
</template>
```
## Supported native components
| ComponentName | Native component mapping | Register Middleware | Description |
| ------------------ | ------------------------ | --------------------- | ----------------------------- |
| anmiation | Animation/AnimationSet | AnimationComponent | Animation component |
| dialog | Modal | ModalComponent | Native modal |
| ul-refresh-wrapper | RefreshWrapperView | ListRefreshComponent | Wrap the ul to pull refresh |
| ul-refresh | RefreshWrapperItemView | ListRefreshComponent | Contents in pull down area |
| swiper | ViewPager | SwiperComponent | Slider |
| swiper-slide | ViewPagerItem | SwiperComponent | Slider Page |