Skip to content

Commit 3dbff9f

Browse files
committed
fix(login): optimize code
1 parent f72df1f commit 3dbff9f

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
ENV = 'development'
22

3-
VUE_APP_BASE_URL = 'http://pedro.7yue.pro/'
3+
VUE_APP_BASE_URL = 'http://face.api.talelin.com/'

src/view/login/login.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@
2121
</div>
2222
</template>
2323

24-
<script setup>
24+
<script>
2525
import { reactive, ref, onMounted } from 'vue'
2626
import { Message } from 'element-plus'
2727
import { useStore } from 'vuex'
28+
import { useRouter } from 'vue-router'
2829
import UserModel from '@/lin/model/user'
2930
import Utils from '@/lin/util/util'
3031
3132
export default {
32-
setup(props, ctx) {
33+
setup() {
3334
const wait = 2000 // 2000ms之内不能重复发起请求
3435
const loading = ref(false)
3536
const store = useStore()
37+
const router = useRouter()
3638
const throttleLogin = ref(null)
3739
3840
const account = reactive({
@@ -50,7 +52,6 @@ export default {
5052
await UserModel.getToken(username, password)
5153
await getInformation()
5254
loading.value = false
53-
const { router } = ctx.root.$options
5455
router.push('/about')
5556
Message.success('登录成功')
5657
} catch (e) {

0 commit comments

Comments
 (0)