vue-promise-modal
Promise를 이용한 Vue.js Modal Component
1,005
| Install | |
|---|---|
npm install vue-promise-modal |
|
| Latest Version: | 0.2.0 |
| Vue: | 2 |
| Last Updated: | Aug 26, 2020 |
| Links: | npm |
Maintainer: junyup0319
skb_project
Promise를 이용한 Vue.js Modal Component
2020 SK Broadband Internship Project
기간
- 2020.07.13 ~ 2020.08.28
기술스택
- Vue.js
- HTML
- SCSS
- TypeScript
- ESLint
Project setup
npm install
Compiles and hot-reloads for development
npm run serve
Compiles and minifies for production
npm run build
Run your unit tests
npm run test:unit
Lints and fixes files
npm run lint
Type
export type SizeType = 'normal' | 'small' | 'big' | 'full';
export type AlignType = 'center' | 'left';
export interface UIOptionType {
size?: SizeType;
align?: AlignType;
negativeMessage?: string;
positiveMessage?: string;
}
Usage
Modal
const uiOption: UIOptionType = {
size: 'normal', // default: normal
align: 'center', // default: center
positiveMessage: '확인', //default: 확인
negativeMessage: '취소',
};
const content: string = 'DESCRIPTION';
const title: string = 'TITLE';
this.$modal.on(uiOption, content, title);
PromiseModal
const uiOption: UIOptionType = {
size: 'normal', // default: normal
align: 'center', // default: center
positiveMessage: '확인', //default: 확인
negativeMessage: '취소',
};
const content: string = 'DESCRIPTION';
const title: string = 'TITLE';
try {
await this.$promiseModal.on(uiOption, content, title);
// resolve - click positive message button
} catch (e) {
// reject - click negative message button
}
MultiPromiseModal
const uiOption: UIOptionType = {
size: 'normal', // default: normal
align: 'center', // default: center
positiveMessage: '확인', //default: 확인
negativeMessage: '취소',
};
const content: string = 'DESCRIPTION';
const title: string = 'TITLE';
const buttons: string[] = ['1', '2', '3'];
try {
const idx = await this.$promiseModal.on(uiOption, content, title, buttons);
// resolve - click positive message button
// idx: index of clicked button
switch (idx) {
case 0: // do 1
break;
case 1: // do 2
break;
case 2: // do 3
break;
default: // do else
}
} catch (e) {
// reject - click negative message button
}
Related Packages
cube-vue-modal
A simple, basic, highly customizable and mobile friendly modal component for Vue...
798
2
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.2.0 | ^2.6.11 | ||
| 0.1.31 | ^2.6.11 | ||
| 0.1.30 | ^2.6.11 | ||
| 0.1.29 | ^2.6.11 | ||
| 0.1.28 | ^2.6.11 | ||
| 0.1.26 | ^2.6.11 | ||
| 0.1.25 | ^2.6.11 | ||
| 0.1.24 | ^2.6.11 | ||
| 0.1.23 | ^2.6.11 | ||
| 0.1.22 | ^2.6.11 | ||
| 0.1.21 | ^2.6.11 | ||
| 0.1.20 | ^2.6.11 | ||
| 0.1.19 | ^2.6.11 | ||
| 0.1.18 | ^2.6.11 | ||
| 0.1.17 | ^2.6.11 | ||
| 0.1.16 | ^2.6.11 | ||
| 0.1.15 | ^2.6.11 | ||
| 0.1.14 | ^2.6.11 | ||
| 0.1.13 | ^2.6.11 | ||
| 0.1.12 | ^2.6.11 | ||
| 0.1.11 | ^2.6.11 | ||
| 0.1.10 | ^2.6.11 | ||
| 0.1.9 | ^2.6.11 | ||
| 0.1.7 | ^2.6.11 | ||
| 0.1.6 | ^2.6.11 | ||
| 0.1.5 | ^2.6.11 | ||
| 0.1.1 | ^2.6.11 | ||
| 0.1.0 | ^2.6.11 |