Я пытаюсь создать свой собственный веб-сайт. мой веб-сайт - это когда интерфейс получает параметры URL-адреса, он автоматически присваивает значение переменной. пример.
- укажите параметр. https://example.com/testt/123123 (id) и 12314 (pw)
- перенаправить главную страницу. https://example.com/testt/123123&12314 -> https://example.com/
- затем нажмите кнопку регистрации, регистрация завершена.
без веб-сервера (spring -boot) https://example.com/testt/123123&12314 работает. но с веб-сервером https://example.com/testt/123123&12314 не работает. Итак, я не знаю, что делать.
логин. vue
<template>
<div>
<div class="login">
<h1 class="title">test 486</h1>
<div>
<button class="solid-button" @click="auth">register</button>
</div>
</div>
</div>
</template>
export default {
data() {
return {
id: "",
pw: "",
};
},
mounted(){
this.id = this.$route.params.id
this.pw = this.$route.params.pw
},
methods: {
auth() {~~~
роутер. js
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
const routes = [{
path: '/',
redirect: '/main',
},
{
path: '/login',
name: 'login',
component: Login,
},
{
path: '/login/:id&pw',
name: 'logintest',
component: Login,
},
{
path: '/testt/:id&:pw',
name: 'testt',
component: test,
},
}
тест. vue
<template>
<div>
<h2>My name is {{id}}</h2>
<h2>My password is {{pw}}</h2>
</div>
</template>
<script>
export default
{ data(){
return {
id: 'no name'
}
},
mounted(){
this.id = this.$route.params.id
this.pw = this.$route.params.pw
},
methods: {
auth() {
let user_id;
user_id = this.id;
let user_pw;
user_pw = this.pw;}
}
}
</script>
<style>
</style>
final.
- go example.com/testt/12323&11123 и назначьте значение.
- redirect example.com/ и нажмите кнопку регистрации, регистрация завершена.