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