1. 程式人生 > 其它 >app直播原始碼,軟體登入時的背景圖更改

app直播原始碼,軟體登入時的背景圖更改

app直播原始碼,軟體登入時的背景圖更改實現的相關程式碼

.background_style{
width:100%;
height:85%;
position:fixed;
background-size:100% 100%;
background-repeat: no-repeat;
background-image: url("../../assets/background_1.jpg");
}

​引用

因為是背景圖片,所有要在最外層div引用

<div class="background_style">

登入實現

引入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直播原始碼,軟體登入時的背景圖更改實現的相關程式碼,更多內容歡迎關注之後的文章