- 博客(11)
- 收藏
- 关注
原创 Vue全局异常捕获封装
异常捕获封装errorPlugin.js/** * 全局异常处理 * @param { * } error * @param {*} vm */function isPromise(ret) { return (ret && typeof ret.then === 'function' && typeof ret.catch === "function")}const errorHandler = (error, vm, info) =&g
2021-03-23 11:05:51 689
原创 移动端初始化根元素的字体大小
假设你需要的1rem = 20px(function () {var html = document.documentElement;function onWindowResize() {html.style.fontSize = html.getBoundingClientRect().width / 20 + ‘px’;}window.addEventListener(‘resize’, onWindowResize);onWindowResize();})();...
2021-03-10 11:31:41 191
原创 scss
1. @supports作用:用于检测当前浏览器是否支持某个css属性,并加载具体样式 链接@supports (display: grid) { .container { color: red; }}当浏览器支持display:grid这一属性时,才会执行里面的样式该方法还支持逻辑运算符 and or not@supports not(display: grid){...}@supports (display: grid) and (position:
2020-11-23 10:23:28 155 1
原创 vue路由器参数解耦
通常情况下,都是用如下方法获取参数export default { methods: { getRouteParamsId() { return this.$route.params.id } }}在组件内部使用 $route 会对某个URL产生强耦合,这限制了组件的灵活性。正确方案:向路由器添加propsconst router = new VueRouter({ routes: [{ path: '/:id', component: C
2020-11-23 10:22:10 197
原创 elementui多个select选项互斥
需求:表格的每一行都有下拉框的选项,之前行选中的,在其他行的下拉选项不展示// 数据结构department_list: [ { department_group_id:1, department_group_name:"结直肠科" }, { department_group_id:2, department_group_name:"肛肠科" }, { department_group_id:3, department_group_name:"胸外科" }]1.
2020-11-20 10:59:28 1956
原创 elementui Loading的封装
对于loading的封装import { Loading } from 'element-ui'let loadingInstance = nullexport const openLoading = function() { loadingInstance = Loading.service({ text: '拼命加载中', 'background': 'rgba(0, 0, 0, 0.6)' })}export const closeLoading = function() { if
2020-08-31 11:32:22 1184
原创 js操作字符串
1.length()作用:获取字符串的长度let str = "like Taylor Swift's songs" console.log(str.length); // 25 空格和标点符号都算2.indexOf()作用:查找指定字符串的位置,返回首次出现的索引,若不存在则返回-1用法:该方法可接收两个参数;第一个表示查找的字符串内容[必填],第二个表示从哪个索引开始查找(从左往右)indexOf()对大小写敏感let str = "like Taylor Swift's so
2020-08-31 09:45:40 152
原创 js操作数组
js操作数组1. join()作用:将数组转为字符串,不传参,默认以逗号分隔;该方法不改变原数组const arr = [1, 2, 3] console.log(arr.join()) // 1,2,3 console.log(arr) // [1, 2, 3]2.push()作用:在数组后面添加项 ()中是添加的内容,字符串需要添加引号const arr = [1, 2, 3] console.log(arr.push(4)) // 4 返回修改后数组的长度
2020-08-31 09:43:51 161
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人