本节目标:
- 新建登录页面(vue), 并简单布局.
- 地址栏可以通过”http://localhost:3000/#/login“访问.
views/Login.vue
建议大家把代表页面的组件都放到”src/views”文件夹下. 然后新建一个Login.vue文件代表登录页. ```vue // Login.vue
这里面用了"ant-design-ui"的input组件, **ant的组件都是以"a"开头的标签**, 更多使用方法参与官网: [https://2x.antdv.com/components/input-cn](https://2x.antdv.com/components/input-cn)<a name="yKxAL"></a>### a-input还是Inputant的组件在模板中我们可以直接使用, 可以是"a-"开头, 也可以是不带"a-", 但是开头字母大写, 比如:```html<a-input/>// 等价<Input/>
大家选2种任意一种都可以,但是切记保证项目都用同一种风格, 本课程选择使用”a-“开头的小写写法.
route.ts
有了页面组件, 我们就要把他加入到路由中, 让我们可以通过地址栏访问.
// router.ts
import { createRouter, createWebHashHistory } from 'vue-router';
// 1. 引入文件
import Login from './views/login.vue';
const router = createRouter({
history: createWebHashHistory(),
// 2. 加载路由配置
routes:[{
path:'/login',
component:Login,
}],
})
export default router;
app.vue()
<template>
<router-view></router-view>
</template>
未完待续
下节课我们讲解登录逻辑的代码.
