项目基本完成
This commit is contained in:
30
UI/src/js/index.js
Normal file
30
UI/src/js/index.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 1、使用哪一个事件
|
||||
* 使用onscroll,此事件移动端与PC端都有效。
|
||||
* 2、如何获取滚动条位置
|
||||
* 获取PC端滚动条位置:document.documentElement.scrollTop
|
||||
* 获取移动端滚动条位置:document.body.scrollTop
|
||||
* 3、如何获取视口宽度
|
||||
* document.documentElement.clientWidth 移动端与PC端都有效。
|
||||
*/
|
||||
window.onload = function(){
|
||||
document.onscroll = function(){
|
||||
//获取滚动条位置
|
||||
let s1 = document.documentElement.scrollTop;
|
||||
let s2 = document.body.scrollTop;
|
||||
let scroll = s1==0?s2:s1;
|
||||
//获取视口宽度
|
||||
let width = document.documentElement.clientWidth;
|
||||
//获取顶部固定块
|
||||
let search = document.getElementById('fixedBox');
|
||||
//判断滚动条超过视口宽度的12%时,搜索块变固定定位
|
||||
if(scroll>width*0.12){
|
||||
search.style.position = 'fixed';
|
||||
search.style.left = '0';
|
||||
search.style.top = '0';
|
||||
}else{
|
||||
search.style.position = 'static';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
20
UI/src/js/orderList.js
Normal file
20
UI/src/js/orderList.js
Normal file
@@ -0,0 +1,20 @@
|
||||
window.onload = function(){
|
||||
//获取显示隐藏按钮DOM数组
|
||||
let showBtnArr = document.getElementsByClassName('fa-caret-down');
|
||||
//获取订单明细DOM数组
|
||||
let detailetBoxArr = document.getElementsByClassName('order-detailet');
|
||||
//设置默认所有订单明细都隐藏
|
||||
for(let i=0;i<detailetBoxArr.length;i++){
|
||||
detailetBoxArr[i].style.display='none';
|
||||
}
|
||||
|
||||
for(let i=0;i<showBtnArr.length;i++){
|
||||
showBtnArr[i].onclick = function(){
|
||||
if(detailetBoxArr[i].style.display=='none'){
|
||||
detailetBoxArr[i].style.display='block';
|
||||
}else{
|
||||
detailetBoxArr[i].style.display='none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
UI/src/js/payment.js
Normal file
17
UI/src/js/payment.js
Normal file
@@ -0,0 +1,17 @@
|
||||
window.onload = function(){
|
||||
//获取显示隐藏按钮DOM对象
|
||||
let showBtn = document.getElementById('showBtn');
|
||||
//获取订单明细DOM对象
|
||||
let detailetBox = document.getElementById('detailetBox');
|
||||
//设置默认订单明细隐藏
|
||||
detailetBox.style.display='none';
|
||||
|
||||
showBtn.onclick = function(){
|
||||
//判断订单明细DOM对象是否隐藏,如果是,就显示,否则就隐藏
|
||||
if(detailetBox.style.display=='none'){
|
||||
detailetBox.style.display='block';
|
||||
}else{
|
||||
detailetBox.style.display='none';
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
import "../scss/app.scss"
|
||||
import "../scss/index.scss"
|
||||
import "../scss/business.scss"
|
||||
import "../scss/businessList.scss"
|
||||
|
||||
export class AppComponent
|
||||
{
|
||||
|
Reference in New Issue
Block a user