Skip to content

Commit

Permalink
Add new files for VueJS 3
Browse files Browse the repository at this point in the history
  • Loading branch information
softins committed Aug 19, 2024
1 parent 17bc5e4 commit 3b37be4
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
8 changes: 8 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
34 changes: 34 additions & 0 deletions src/focus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// got rid of compatible check for Vue 3
// import Vue from 'vue';

// export var version = '2.1.0';

// var compatible = (/^2\./).test(Vue.version);
// if (!compatible) {
// Vue.util.warn('VueFocus ' + version + ' only supports Vue 2.x, and does not support Vue ' + Vue.version);
// }


export var focus = {
inserted: function(el, binding) {
if (binding.value) el.focus();
else el.blur();
},

componentUpdated: function(el, binding) {
if (binding.modifiers.lazy) {
if (Boolean(binding.value) === Boolean(binding.oldValue)) {
return;
}
}

if (binding.value) el.focus();
else el.blur();
},
};

export var mixin = {
directives: {
focus: focus,
},
};
19 changes: 19 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue()
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
host: true
}
})

0 comments on commit 3b37be4

Please sign in to comment.