app直播源代码,登录界面的背景图自定义插入

app直播源代码,登录界面的背景图自定义插入实现的相关代码
登录实现
引入Element UI
Element UI

通过npm安装
执行此命令

npm i element-ui -S

 

然后再main.js中导入Element UI库

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

 

通过引入样式库
直接在需要使用Element UI组件的页面声明即可

<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>

 


实现

复制代码
<el-form status-icon label-width="50px" label-position="left" class="login-page" >
<h2 class="login_Title">账号登录</h2>
<el-form-item label="账号" prop="username" >
<el-input type="text" v-model="username" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input type="password" v-model="password" autocomplete="off" show-password></el-input>
</el-form-item>
<el-form-item class="button_center">
<el-button type="primary" @click="LoginNleCloud" style="width:50%;" >提交</el-button>
</el-form-item>
</el-form>
复制代码

 

双向绑定账号密码

v-model="username"
v-model="password"

 

定义字段

data(){
return{
password: "",
username: "",
}

 

设置点击事件
Es6缩写

@click="LoginNleCloud"

 


普通写法

v-on:click="LoginNleCloud"

 

需要在methods才能定义方法
然后对账户密码进行判断
如果成功则跳转路由,失败则提醒用户

复制代码
methods:{
LoginNleCloud(){
if (this.username === "hntdiot" && this.password === "hntdiot")
{
window.nleApi = new NLECloudAPI()
const res = window.nleApi.userLogin(this.username,this.password,true)
res.completed(function (res) {
window.Flag = true
//alert("Success!")
console.log(res)
})
if ( window.Flag === true){
this.$router.push('/console')
console.log(window.Flag)
}
}else {
alert("账户或者密码错误!")
}
}
复制代码

 


以上就是 app直播源代码,登录界面的背景图自定义插入实现的相关代码,更多内容欢迎关注之后的文章

posted @   云豹科技-苏凌霄  阅读(127)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示