Browse Source

feat: add config

main
mashirozx 8 months ago
parent
commit
0d46c1b715
  1. 2
      .gitignore
  2. 42
      .vscode/settings.json
  3. 9
      .vscode/snippets.json
  4. 1
      package.json
  5. 1
      src/main.js
  6. 2
      src/stores/modules/user.js
  7. 10
      src/views/auth/login.vue

2
.gitignore vendored

@ -15,7 +15,7 @@ pnpm-debug.log*
# Editor directories and files
.idea
.vscode
# .vscode
*.suo
*.ntvs*
*.njsproj

42
.vscode/settings.json vendored

@ -0,0 +1,42 @@
{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
// "source.fixAll": true,
},
"eslint.validate": [
"javascript",
"typescript"
],
"files.associations": {
"*.json": "jsonc"
},
"emmet.extensionsPath": [
".vscode/"
],
"emmet.triggerExpansionOnTab": true,
"emmet.showExpandedAbbreviation": "always",
"emmet.includeLanguages": {
"typescript": "typescriptreact",
"vue": "html",
},
"prettier.requireConfig": true,
"prettier.configPath": ".prettierrc.js",
"css.validate": false,
"less.validate": false,
"scss.validate": false,
"cSpell.words": [
"mdicon",
"mdijs"
],
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"git.ignoreLimitWarning": true,
}

9
.vscode/snippets.json vendored

@ -0,0 +1,9 @@
{
"html": {
"snippets": {
"divc": "div[class=${1}]",
"slot": "slot[name=${1}]",
"ic": "i[class=${1}]"
}
}
}

1
package.json

@ -5,6 +5,7 @@
"license": "MIT",
"scripts": {
"dev": "vue-cli-service serve",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint",

1
src/main.js

@ -3,7 +3,6 @@ import VueCompositionAPI from "@vue/composition-api";
import { PiniaVuePlugin } from "pinia";
import store from "@/stores";
import App from "@/App.vue";
// eslint-disable-next-line no-unused-vars
import router from "@/routers";
import ElementUI from "element-ui";
import VueTippy, { TippyComponent } from "vue-tippy";

2
src/stores/modules/user.js

@ -3,7 +3,7 @@ import store from "@/stores";
export const useUserStore = defineStore("user", {
state: () => ({
token: "23333",
token: "",
username: "",
permissions: ["admin"],
}),

10
src/views/auth/login.vue

@ -22,13 +22,17 @@ export default defineComponent({
},
rules: {},
showPassWord: false,
fetching: false,
});
const methods = {
handleToggleShowPassword() {
state.showPassWord = !state.showPassWord;
},
handleLoginEvent() {
async handleLoginEvent() {
state.fetching = true;
await new Promise((resolve) => setTimeout(resolve, 1000));
state.fetching = false;
userStore.login();
// you can do nothing with this vue-router bug
// https://segmentfault.com/q/1010000022868141
@ -63,7 +67,7 @@ export default defineComponent({
</span>
</el-form-item>
<el-form-item>
<el-button class="button" type="primary" size="default" @click="handleLoginEvent">登录</el-button>
<el-button class="button" type="primary" size="default" :loading="fetching" @click="handleLoginEvent">登录{{ fetching ? "" : "" }}</el-button>
</el-form-item>
</el-form>
</div>
@ -115,7 +119,7 @@ export default defineComponent({
top: 0;
right: 0;
color: theme.$primary-color;
font-size: 1.5rem;
font-size: 1.2rem;
text-align: inherit;
margin-right: calc(0.25em);
}

Loading…
Cancel
Save