find(返回符合傳入測試(函數)條件的數組元素。)
let list =[
{id: 4, pid: 3, menuName: "操作日誌", menuLevel: 2, url: "/operatelogs"},
{id: 8, pid: 7, menuName: "富文本", menuLevel: 2, url: "/richtext"},
{id: 11, pid: 7, menuName: "echarts", menuLevel: 2, url: "/echarts"},
]
select = list.find((value) => {
return value.url === '/echarts' && value
})
console.log(select) //{id: 11, pid: 7, menuName: "echarts", menuLevel: 2, url: "/echarts"}
如何上代碼,返回的是符合條件的數組元素對象。
通過id,或者數字中對象的key值拿到數據
findIndex 拿到對象的下標
var index= list.findIndex(function(obj){
return obj.id === id
})
請求方式
請求傳參方式
1.拼接在url後面。
2.body form-data 方式傳參。
3.body JSON形式傳參。
如果是'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'的話,則爲formdata方式,
如果是'Content-Type':application/json,則爲 json的方式。
css
css定位居中
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%)
鼠標懸停顯示不同的樣式
cursor:pointer /* 手 */;
自定義樣式
cursor: url('../../images/icon_Currentrisk.png'),auto;
取消頁面雙擊選中文本
user-select:none;
-moz-user-select:none;/*火狐*/
-webkit-user-select:none;/*webkit瀏覽器*/
-ms-user-select:none;/*IE10*/
-khtml-user-select:none;/*早期瀏覽器*/
更多請看 https://www.runoob.com/w3cnote/moible-web-front-source.html