简单的几个vue的添加

cxy 1 month ago
parent e14c9f91a0
commit 1a0cecdfec

@ -0,0 +1,12 @@
//
<script setup>
</script>
<template>
</template>
<style scoped>
</style>

@ -0,0 +1,25 @@
//
<!-- src/components/LoginUser.vue -->
<template>
<form @submit.prevent="login">
<input v-model="username" type="text" placeholder="用户名">
<input v-model="password" type="password" placeholder="密码">
<button type="submit">登录</button>
</form>
</template>
<script>
export default {
data() {
return {
username: '',
password: '',
};
},
methods: {
async login() {
// API
},
},
};
</script>

@ -0,0 +1,19 @@
import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '../views/HomeView.vue';
const routes = [
{
path: '/',
name: 'Home',
component: HomeView,
},
// 其他路由...
];
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
});
export default router;

@ -1,7 +1,26 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
// // https://vitejs.dev/config/
// export default defineConfig({
// plugins: [vue()],
// })
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue()],
}) resolve: {
alias: {
'@/': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
}
});
Loading…
Cancel
Save