Skip to content

Commit

Permalink
feat: vue3 version
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Jan 15, 2022
1 parent 80788c3 commit 872feef
Show file tree
Hide file tree
Showing 42 changed files with 1,525 additions and 1,010 deletions.
3 changes: 3 additions & 0 deletions packages/demo-vue3/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead
5 changes: 5 additions & 0 deletions packages/demo-vue3/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
21 changes: 21 additions & 0 deletions packages/demo-vue3/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/vue3-essential',
'@vue/standard',
],
parserOptions: {
parser: 'babel-eslint',
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'comma-dangle': ['error', 'always-multiline'],
},
ignorePatterns: [
'../v-tooltip/**/*',
],
}
26 changes: 26 additions & 0 deletions packages/demo-vue3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.DS_Store
node_modules
/dist

/tests/e2e/videos/
/tests/e2e/screenshots/


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
29 changes: 29 additions & 0 deletions packages/demo-vue3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# demo2

## Project setup
```
yarn install
```

### Compiles and hot-reloads for development
```
yarn serve
```

### Compiles and minifies for production
```
yarn build
```

### Run your end-to-end tests
```
yarn test:e2e
```

### Lints and fixes files
```
yarn lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
5 changes: 5 additions & 0 deletions packages/demo-vue3/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset',
],
}
3 changes: 3 additions & 0 deletions packages/demo-vue3/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pluginsFile": "tests/e2e/plugins/index.js"
}
33 changes: 33 additions & 0 deletions packages/demo-vue3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "demo2",
"version": "1.0.0-beta.5",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"floating-vue": "^1.0.0-beta.5",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-e2e-cypress": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-standard": "^5.1.2",
"babel-eslint": "^10.1.0",
"eslint": "^7.24.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.9.0"
}
}
Binary file added packages/demo-vue3/public/favicon.ico
Binary file not shown.
17 changes: 17 additions & 0 deletions packages/demo-vue3/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<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>
44 changes: 44 additions & 0 deletions packages/demo-vue3/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<script setup>
import { demos } from './router'
</script>

<template>
<nav class="nav">
<router-link
v-for="(route, index) of demos"
:key="index"
:to="route.path"
>
{{ route.meta.label }}
</router-link>
</nav>
<router-view/>
</template>

<style>
body {
font-family: Avenir, Helvetica, Arial, sans-serif;
color: #2c3e50;
}
</style>

<style lang="postcss">
.nav a {
text-decoration: none;
color: black;
padding: 2px 4px;
}
.nav a:not(:last-child) {
border-right: 1px #ddd solid;
}
.nav a:hover {
background: #eee;
}
.nav a.router-link-active {
background: black;
color: white;
}
</style>
Binary file added packages/demo-vue3/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions packages/demo-vue3/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-e2e-cypress" target="_blank" rel="noopener">e2e-cypress</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>

<script>
export default {
name: 'HelloWorld',
props: {
msg: String,
},
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
10 changes: 10 additions & 0 deletions packages/demo-vue3/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createApp } from 'vue'
import FloatingVue from 'floating-vue'
import 'floating-vue/dist/style.css'
import App from './App.vue'
import router from './router'

const app = createApp(App)
app.use(router)
app.use(FloatingVue)
app.mount('#app')
70 changes: 70 additions & 0 deletions packages/demo-vue3/src/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { createRouter, createWebHistory } from 'vue-router'
import Home from './views/Home.vue'

export const demos = [
{
path: '/directive/demo1',
component: () => import('./views/directive/VTooltipDemo1.vue'),
meta: {
label: 'Directive simple',
},
},
{
path: '/directive/demo2',
component: () => import('./views/directive/VTooltipDemo2Html.vue'),
meta: {
label: 'Directive HTML',
},
},
{
path: '/directive/demo3',
component: () => import('./views/directive/VTooltipDemo3Async.vue'),
meta: {
label: 'Directive async',
},
},
{
path: '/directive/demo4',
component: () => import('./views/directive/VTooltipDemo4Input.vue'),
meta: {
label: 'Directive input',
},
},
{
path: '/directive/demo5',
component: () => import('./views/directive/VTooltipDemo5Manual.vue'),
meta: {
label: 'Directive manual',
},
},
{
path: '/component/demo1',
component: () => import('./views/component/DropdownDemo1.vue'),
meta: {
label: 'Dropdown 1',
},
},
{
path: '/component/demo2',
component: () => import('./views/component/DropdownDemo2Manual.vue'),
meta: {
label: 'Dropdown 2',
},
},
]

const routes = [
{
path: '/',
name: 'Home',
component: Home,
},
...demos,
]

const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
})

export default router
3 changes: 3 additions & 0 deletions packages/demo-vue3/src/views/Home.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<h1>Tooltip demo</h1>
</template>
33 changes: 33 additions & 0 deletions packages/demo-vue3/src/views/component/DropdownDemo1.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<h1>Dropdown demo</h1>

<div class="row">
<VDropdown>
<button id="dropdown-btn">Click me</button>

<template #popper>
<div class="my-menu">
✌️ Hello from v-tooltip + Vue 3
</div>

<div>
<button v-close-popper>Close</button>
<button v-close-popper="true">Close</button>
<button v-close-popper="false">Don't close</button>
</div>
</template>
</VDropdown>

<button id="noop-btn">I do nothing.</button>
</div>
</template>

<style lang="postcss" scoped>
.row {
display: flex;
}
.my-menu {
padding: 20px;
}
</style>
Loading

0 comments on commit 872feef

Please sign in to comment.