1.1.3 • Published 4 years ago

vue-unif-js v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

vue-unif-js

A VueJS plugin to use unif-js.

Installation

npm install vue-unif-js --save

// or

yarn add vue-unif-js

Add file plugins/unif-js.js in src of the project.

// unif-js.js
import Vue from 'vue';
import VueUnifJS from 'vue-unif-js';

Vue.use(VueUnifJS, {
  fullPage: true, // The html, body and u-content in height 100%
});

Add line in main.js

import './plugins/unif-js';

Componentes

This plugin contains 2 components, u-container and u-session.

UContainer

The component u-container is root element to use unif-js.

Your Component.vue:

<template>
  <u-container router>
    <view-first-session />
    <view-second-session />
  </u-container>
</template>

<script>
import ViewFirstSession from './views/FirstSession.vue';
import ViewSecondSession from './views/SecondSession.vue';

export default {
  components: {
    ViewFirstSession,
    ViewSecondSession,
  },
};
</script>

Using Vue Router

If you get controll session by Vue Router, set the route like this:

const routes = [
  // Any another routes before
  {
    path: '/login',
    component: Components,
  },
  // Route with sessions
  {
    path: '/',
    component: Home,
    children: [{ path: ':session', name: 'unifjs' }], // Important name unifjs
  },
  // Redirect
  {
    path: '*',
    redirect: '/',
  },
];

Props

PropTypeDefaultDescription
valueStringundefinedThe current session identifier
routerBooleanfalseUse the Vue Router to controll sessions
tagString'div'The tag of content
disable-hashBooleanfalseDisable hash navigation
disable-wheelBooleanfalseDisable capture wheel events
disable-touchBooleanfalseDisable capture touch events
disable-keysBooleanfalseDisable capture any key events
disable-arrow-keysBooleanfalseDisable arrow up and arrow down keys events
disable-page-keysBooleanfalseDisable page up and page down keys events
disable-space-bar-keyBooleanfalseDisable space bar key event
disable-home-end-keysBooleanfalseDisable home and end keys events

Events

EventValueDescription
inputStringSession Identifier
changeObject { from: String , to: String }Changed session

USession

The component u-session is a session of content in page.

The session is a component like this:

// ./views/FirstSession.vue
<template functional>
  <u-session id="about" fill-height>
    <h1>First Session</h1>
  </u-session>
</template>

Props

PropTypeDefaultDescription
idString'page#'Change the hash in url if is enabled
fill-heightBooleanfalseThe session contains height 100%
1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago