Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
18,513 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { PluginOptions } from "vue-toastification/dist/types/src/types"; | ||
import ToastInterface from "vue-toastification/dist/types/src/ts/interface"; | ||
declare let provideToast: (options?: PluginOptions) => void; | ||
declare let useToast: () => ReturnType<typeof ToastInterface>; | ||
export { provideToast, useToast }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { inject, provide } from "@vue/composition-api"; | ||
import { createToastInterface } from "vue-toastification"; | ||
|
||
const toastSymbol = Symbol("Vue Toastification"); | ||
|
||
/** @type {ReturnType<typeof createToastInterface>} */ | ||
const injectDefault = {}; | ||
|
||
// Generate provider and consumer | ||
const provideToast = options => | ||
provide(toastSymbol, createToastInterface(options)); | ||
const useToast = () => inject(toastSymbol, injectDefault); | ||
|
||
export { provideToast, useToast }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
> 1% | ||
last 2 versions | ||
not dead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true | ||
}, | ||
extends: [ | ||
"plugin:vue/essential", | ||
"eslint:recommended", | ||
"@vue/typescript/recommended", | ||
"@vue/prettier", | ||
"@vue/prettier/@typescript-eslint" | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2020 | ||
}, | ||
rules: { | ||
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off", | ||
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off" | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# vue-composition-api-typescript | ||
|
||
## Project setup | ||
``` | ||
yarn install | ||
``` | ||
|
||
### Compiles and hot-reloads for development | ||
``` | ||
yarn serve | ||
``` | ||
|
||
### Compiles and minifies for production | ||
``` | ||
yarn build | ||
``` | ||
|
||
### Lints and fixes files | ||
``` | ||
yarn lint | ||
``` | ||
|
||
### Customize configuration | ||
See [Configuration Reference](https://cli.vuejs.org/config/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ["@vue/cli-plugin-babel/preset"] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "vue-composition-api-typescript", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"serve": "vue-cli-service serve", | ||
"build": "vue-cli-service build", | ||
"lint": "vue-cli-service lint" | ||
}, | ||
"dependencies": { | ||
"@vue/composition-api": "^0.5.0", | ||
"core-js": "^3.6.4", | ||
"vue": "^2.6.11", | ||
"vue-toastification": "^1" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^2.26.0", | ||
"@typescript-eslint/parser": "^2.26.0", | ||
"@vue/cli-plugin-babel": "~4.3.0", | ||
"@vue/cli-plugin-eslint": "~4.3.0", | ||
"@vue/cli-plugin-typescript": "~4.3.0", | ||
"@vue/cli-service": "~4.3.0", | ||
"@vue/eslint-config-prettier": "^6.0.0", | ||
"@vue/eslint-config-typescript": "^5.0.2", | ||
"eslint": "^6.7.2", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"eslint-plugin-vue": "^6.2.2", | ||
"lint-staged": "^9.5.0", | ||
"prettier": "^1.19.1", | ||
"sass": "^1.26.3", | ||
"sass-loader": "^8.0.2", | ||
"typescript": "~3.8.3", | ||
"vue-template-compiler": "^2.6.11" | ||
}, | ||
"gitHooks": { | ||
"pre-commit": "lint-staged" | ||
}, | ||
"lint-staged": { | ||
"*.{js,jsx,vue,ts,tsx}": [ | ||
"vue-cli-service lint", | ||
"git add" | ||
] | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||
<title><%= htmlWebpackPlugin.options.title %></title> | ||
</head> | ||
<body> | ||
<noscript> | ||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> | ||
</noscript> | ||
<div id="app"></div> | ||
<!-- built files will be auto injected --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template> | ||
<div id="app"> | ||
<img alt="Vue logo" src="./assets/logo.png" /> | ||
<HelloWorld | ||
msg="Welcome to the Vue Toastification + Typescript + Composition API example" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from "@vue/composition-api"; | ||
import { provideToast } from "vue-toastification/composition"; | ||
import "vue-toastification/dist/index.css"; | ||
import HelloWorld from "./components/HelloWorld.vue"; | ||
export default defineComponent({ | ||
name: "App", | ||
components: { | ||
HelloWorld | ||
}, | ||
setup() { | ||
provideToast({ maxToasts: 5 }); | ||
} | ||
}); | ||
</script> | ||
|
||
<style lang="scss"> | ||
#app { | ||
font-family: Avenir, Helvetica, Arial, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
text-align: center; | ||
color: #2c3e50; | ||
margin-top: 60px; | ||
} | ||
</style> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.