5. 「智软新航道 多维发展赋能系列活动 第三期 项目技能分享--Vue 」
2025/4/15大约 34 分钟
提示
这是在一次学术分享活动中,我分享的 Vue3 网络前端开发的 PPT 内容,主要介绍了 HTML 基础、CSS 基础和 Vue3 的基本概念、组件、路由、状态管理等,以及如何使用 Vue3 开发一个简单的网络前端应用。
因为配置问题,PPT 中的代码高亮似乎丢失了,敬请谅解
看不清的话,点击一下幻灯片后按 F
开启幻灯片全屏模式
提示
接下来是 CSS 基础部分讲完后示例环节中使用的两个例子的代码
第一个是一个简单的上侧导航栏
第二个是一个简单的登陆界面
可以自行复制到别处查看效果
<style>
.header {
display: flex;
align-items: center;
padding: 10px;
background-color: #f0f0f0;
border-radius: 4px;
}
.header-logo {
width: 40px;
height: 40px;
margin-right: 10px;
}
.header-title {
color: #111;
font-size: 28px;
margin: auto 0;
}
.header-btn {
color: #eee;
background-color: #6f106e;
height: 40px;
width: 80px;
margin-left: auto;
border: none;
border-radius: 4px;
box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.8);
transition: all .3s ease-in-out;
}
.header-btn:hover {
cursor: pointer;
background-color: #5d0b5d;
box-shadow: 2px 4px 8px rgb(0, 0, 0);
transform: translateY(-1px);
}
.header-btn:active {
background-color: #4b0a4b;
box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.6);
transform: translateY(1px);
}
</style>
<nav class="header">
<a class="header-logo" href="https://www.nju.edu.cn">
<img src="./assets/nju-icon.png" />
</a>
<p class="header-title">
南京大学
</p>
<button class="header-btn">
登录
</button>
</nav>
<style>
html {
font-size: 2vw;
}
.bg-img {
position: fixed;
left: 0;
width: 100vw;
height: auto;
}
.main-container {
position: fixed;
left: 0;
width: 100vw;
height: calc(100vw / 16 * 9);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.login-panel {
width: 80%;
height: 75%;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 16px;
border-radius: 0.5rem;
box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.6);
backdrop-filter: blur(8px);
}
.login-title {
margin-bottom: 2rem;
font-size: 2rem;
color: white;
text-shadow: 1px 2px 8px rgba(255, 255, 255, 0.5);
}
.input-item {
display: flex;
align-items: center;
margin-bottom: 1rem;
}
.input-label {
text-align: left;
width: 5rem;
font-size: 1rem;
color: white;
text-shadow: 1px 2px 8px rgba(255, 255, 255, 0.5);
}
.input {
border: 2px solid rgba(255, 255, 255, 0.6);
background-color: #131313;
font-size: 0.8rem;
height: min-content;
padding: 5px 10px;
border-radius: 4px;
box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.8);
transition: all .3s ease;
width: 16rem;
}
.input:focus {
border: 2px solid #409eff;
box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.6);
}
.login-content {
display: flex;
flex-direction: column;
align-items: center;
}
</style>
<img class="bg-img" src="./assets/background-image.jpg" />
<main class="main-container">
<div class="login-panel">
<div class="login-content">
<p class="login-title">登录</p>
<div class="input-item">
<label class="input-label">用户名</label>
<input class="input" type="text" placeholder="请输入用户名" />
</div>
<div class="input-item">
<label class="input-label">密码</label>
<input class="input" type="password" placeholder="请输入密码" />
</div>
</div>
</div>
</main>