2018年7月17日

vue插槽?

摘要: 假定我们有一个 app-layout 组件,它的模板为: <div class="container"> <header> <slot name="header"></slot> </header> <main> <slot></slot> </main> <footer> <slot name=" 阅读全文

posted @ 2018-07-17 21:25 向往回得来 阅读(164) 评论(0) 推荐(0) 编辑

封装jquery高亮插件?

摘要: 完整的高亮插件代码如下: //闭包限定命名空间(function ($) { $.fn.extend({ "highLight": function (options) { //检测用户传进来的参数是否合法 if (!isValid(options)) return this; var opts = 阅读全文

posted @ 2018-07-17 21:15 向往回得来 阅读(183) 评论(0) 推荐(0) 编辑

axios拦截器?

摘要: // 引入axios以及element ui中的loading和message组件 import axios from 'axios' import { Loading, Message } from 'element-ui' // 超时时间 axios.defaults.timeout = 500 阅读全文

posted @ 2018-07-17 20:52 向往回得来 阅读(1571) 评论(0) 推荐(0) 编辑

小程序的生命周期函数?

摘要: onLoad Function 生命周期函数--监听页面加载 onReady Function 生命周期函数--监听页面初次渲染完成 onShow Function 生命周期函数--监听页面显示 onHide Function 生命周期函数--监听页面隐藏 onUnload Function 生命周 阅读全文

posted @ 2018-07-17 20:41 向往回得来 阅读(128) 评论(0) 推荐(0) 编辑

jsonp的原理?

摘要: ajax请求受同源策略影响,不允许进行跨域请求,而script标签src属性中的链接却可以访问跨域的js脚本,利用这个特性,服务端不再返回JSON格式的数据,而是返回一段调用某个函数的js代码,在src中进行了调用,这样实现了跨域。 Ajax工作原理是 相当于在用户和服务器之间加了—个中间层(AJA 阅读全文

posted @ 2018-07-17 20:37 向往回得来 阅读(83) 评论(0) 推荐(0) 编辑

导航