Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vitorluizc/vue-uuid
Add UUID to Vue instance.
https://github.com/vitorluizc/vue-uuid
javascript uuid vue vue-plugin vue-uuid
Last synced: about 1 month ago
JSON representation
Add UUID to Vue instance.
- Host: GitHub
- URL: https://github.com/vitorluizc/vue-uuid
- Owner: VitorLuizC
- License: mit
- Created: 2017-10-25T18:56:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T07:21:28.000Z (over 1 year ago)
- Last Synced: 2024-10-10T07:05:01.796Z (about 1 month ago)
- Topics: javascript, uuid, vue, vue-plugin, vue-uuid
- Language: JavaScript
- Homepage:
- Size: 1020 KB
- Stars: 73
- Watchers: 3
- Forks: 7
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vue UUID
Add UUID to Vue instance.
[![Build Status](https://travis-ci.org/VitorLuizC/vue-uuid.svg?branch=master)](https://travis-ci.org/VitorLuizC/vue-uuid)
## Install
Installation is very easy, you just need to install using NPM or Yarn.
```sh
npm i vue-uuid
```Vue's `use` method will do the trick adding to Vue.
```js
import { createApp } from "vue";
import withUUID from "vue-uuid";const app = withUUID(
createApp({
// ...
}),
);
```## Usage
After installation `$uuid` is available on instance, so you can use inside
components **template** and script, like the example below.```vue
{{ uuid }}
Generate V1
Generate V3
Generate V4
Generate V5
import { uuid } from 'vue-uuid'; // uuid object is also exported to things
// outside Vue instance.const NAMESPACE = "65f9af5d-f23f-4065-ac85-da725569fdcd";
export default {
data () {
return {
NAMESPACE,
uuid: uuid.v1(),
v1: this.$uuid.v1(),
v3: this.$uuid.v3(),
v4: this.$uuid.v4(),
v5: this.$uuid.v5("Name 2", NAMESPACE)
};
}
};```