@overlastic/vue2 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -74
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,83 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://overlastic.vercel.app/" target="blank">
|
|
3
|
+
<img src="https://github.com/hairyf/overlastic/raw/master/docs/public/circle.svg" width="120" alt="Nest Logo" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
2
6
|
|
|
3
|
-
>
|
|
7
|
+
<p align="center">
|
|
8
|
+
A create modal | dialog | popup promise deferred library
|
|
9
|
+
</p>
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/@overlastic/vue2"><img src="https://img.shields.io/npm/v/@overlastic/vue2.svg" alt="NPM Version" /></a>
|
|
13
|
+
<a href="https://www.npmjs.com/@overlastic/vue2"><img src="https://img.shields.io/npm/l/@overlastic/vue2.svg" alt="Package License" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/@overlastic/vue2"><img src="https://img.shields.io/npm/dm/@overlastic/vue2.svg" alt="NPM Downloads" /></a>
|
|
15
|
+
</p>
|
|
6
16
|
|
|
7
|
-
|
|
8
|
-
```sh
|
|
9
|
-
pnpm add @overlastic/vue
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
With yarn:
|
|
13
|
-
```sh
|
|
14
|
-
yarn add @overlastic/vue
|
|
15
|
-
```
|
|
17
|
+
## Description
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Create messages or dialog overlays using Overlastic in Vue2 APP.
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
## Installation
|
|
20
22
|
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
import Vue from 'vue'
|
|
24
|
-
import unoverlay from '@overlastic/vue'
|
|
25
|
-
|
|
26
|
-
const app = new Vue({})
|
|
27
|
-
app.use(unoverlay)
|
|
23
|
+
```bash
|
|
24
|
+
$ npm install --save @overlastic/vue2
|
|
28
25
|
```
|
|
29
26
|
|
|
30
|
-
##
|
|
31
|
-
|
|
32
|
-
### Step 1: Define Component
|
|
33
|
-
|
|
34
|
-
overlays is suitable for most components. Using useOverlayDefine can provide finer control over the component process.
|
|
35
|
-
|
|
36
|
-
```vue
|
|
37
|
-
<!-- overlay.vue -->
|
|
38
|
-
<script>
|
|
39
|
-
import { useOverlayDefine } from '@overlastic/vue2'
|
|
40
|
-
export default {
|
|
41
|
-
mixins: [useOverlayDefine({ duration: 1000 })],
|
|
42
|
-
methods: {
|
|
43
|
-
onClick() {
|
|
44
|
-
// use this.$visible
|
|
45
|
-
// use this.$resolve or this.$reject
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
<template>
|
|
52
|
-
<div v-if="visible" @click="resolve(`${title}:confirmed`)">
|
|
53
|
-
{{ title }}
|
|
54
|
-
</div>
|
|
55
|
-
</template>
|
|
56
|
-
```
|
|
27
|
+
## Quick Start
|
|
57
28
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
You can use the `defineOverlay` method to convert the component into a modal dialog in Javascript / Typescript, which allows you to call it.
|
|
61
|
-
|
|
62
|
-
```ts
|
|
63
|
-
import { defineOverlay } from '@overlastic/vue'
|
|
64
|
-
import OverlayComponent from './overlay.vue'
|
|
65
|
-
|
|
66
|
-
// Convert to imperative callback
|
|
67
|
-
const callback = defineOverlay(OverlayComponent)
|
|
68
|
-
// Call the component and get the value of the resolve callback
|
|
69
|
-
const value = await callback({ title: 'callbackOverlay' })
|
|
70
|
-
// value === "callbackOverlay:confirmed"
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
You can also use `renderOverlay` to directly call the component and skip the `defineOverlay` method.
|
|
74
|
-
|
|
75
|
-
```ts
|
|
76
|
-
import { renderOverlay } from '@overlastic/vue'
|
|
77
|
-
import OverlayComponent from './overlay.vue'
|
|
78
|
-
|
|
79
|
-
const value = await renderOverlay(OverlayComponent, {
|
|
80
|
-
title: 'useOverlayDefine'
|
|
81
|
-
})
|
|
82
|
-
// value === "useOverlayDefine:confirmed"
|
|
83
|
-
```
|
|
29
|
+
[Overview & Tutorial](https://overlastic.vercel.app/en/vue/vue2)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@overlastic/vue2",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/hairyf/overlastic#readme",
|
|
7
7
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"mitt": "^3.0.1",
|
|
32
32
|
"pascal-case": "3.1.2",
|
|
33
|
-
"@overlastic/core": "^0.5.
|
|
33
|
+
"@overlastic/core": "^0.5.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"vue": "^2.6"
|