- 博客(15)
- 收藏
- 关注
原创 js实现原生split方法
不用api 实现 ‘www.ass.com.cnaasd’ => 反转 let url =www.ass.com.cnaasd var arr=[] var index = 0 for(var i = 0;i<url.length; i++){ if(url[i]=='.'){ let str = '' for(let j=index;j<i;j++){ con
2021-11-03 15:38:11
281
原创 vue-json-excel前端导出excel
vue-json-excel前端导出excel下载vue-json-excelnpm install vue-json-excel -Smian.js引入import JsonExcel from ‘vue-json-excel’注册组件downloadExcelVue.component(‘downloadExcel’, JsonExcel)页面引入<download-excel class="export-excel-wrapper" :data="table
2021-09-27 11:20:23
191
原创 vue+高德地图api (总结)
引入地图:public 中index.html引入//&后面为引入的工具 <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key="你的key"&plugin=AMap.Autocomplete,AMap.PlaceSearch"></script> 新创地图data中定义map:’’实列地图:<div id="container" sty
2021-09-24 11:27:34
286
原创 vue实现头部吸顶描点
vue实现头部吸顶描点效果:页面滚到具体位置时,顶部吸附(粘性定位),点击描点跳转到对应位置,滚到到对应位置描点自动切换。html:使用elment ui,name对应每个位置的ref名称, <el-tabs @tab-click="jump" v-model="tabActive"> <el-tab-pane label="基础信息" name="base" ></el-tab-pane>
2021-09-24 11:12:11
265
原创 基于VUE+element+express实现电商购物项目
项目地址 :https://github.com/wxbdhcm/XD-Mall基于VUE开发的电商项目 node + express + mysql 实现后台数据管理新创用户地址到数据库后台管理购物车提交订单用户注册:更换头像:切换登录:删除商品、 订单、用户等...
2021-06-23 13:49:31
473
原创 vue-router scrollBehavior
scrollBehavior可以让我们在进行路由跳转后页面滚动到固定的位置,增加用户的体验度。scrollBehavior的返回值为一个对象,里面包含x轴跟y轴长度: return { x: 0, y: 900 }在定义路由跳转时,对to的路由添加hash属性,属性值为某个标签的id可简写为"/path#id" this.$router.push('/path#router-link')然后在指定位置的标签添加相应id <
2021-06-14 15:15:09
344
原创 解决 vue $bus.emit 第一次点击不触发事件
场景:兄弟组件传值,点击A组件下方pushB组件路由,第一次点击时不能传参由于on在on 在on在emit后面执行,所以在emit执行时 没有on来接受参数,导致第一次触发时不能执行解决方式: 先加载B组件,将emit写成异步执行方法 this.$router.push('/cmDetails') setTimeout(() => { Bus.$emit('setCmDetails',{name,price,img,introduction}) },
2021-06-12 16:46:25
2306
6
原创 vue.config.js设置proxy实现跨域
在vue-cli中新建vue.config.js文件module.exports = { //publicPath: './', //runtimeCompiler: true, devServer: { // 设置代理 proxy: { '/api': { target: 'http://localhost:8000', changeOrigin: true,//设置是否跨域 pathRewrite: {
2021-05-31 16:04:37
398
原创 手写Promise
class myPromise{ constructor(e){ this.result = undefined this.state = "pending" this.reson = undefined this.successCB =[] this.failCB = [] let resolve=(value)=>{ if(this.state === "pending"){ this.result =value .
2021-05-11 14:23:15
34
原创 手写call、apply
```javascriptFunction.prototype.myCall = function(func){ func? func = func:window if(typeof this !=='function') return func._this = this //接收参数,maCall的arguments第一个参数为改变this指向的对象,所以要存放第二个之后的参数 //方法一 // let arr =Array.prototype.
2021-05-11 14:21:56
47
原创 清除浮动三种方法
清除浮动三种方法html代码<body> <div class="outer"> <div ></div> <div></div> </div> <div class="grey"> </div> </body>css:.outer{ background-color: blue;
2021-04-08 13:44:31
57
原创 vue防抖实现
vue防抖实现data中定于timer实现clearTimeout(this.timer) this.timer = setTimeout(()=>{ this.axios({ method:'get', url:'data.json', }).then(res =>{ console.log('防抖实现'+res.data) }) },10
2021-04-04 13:57:12
84
原创 vue节流实现
vue节流实现创建点击事件<el-button @click="debounce">debounce</el-button>如果按照传统js写法:debounce(){ var flag = 1 if(flag === 1){ flag = 0 console.log('flag = ' + flag) } }此时由于每次的点击时,都会调用一次debounce方法,所以还是会不
2021-04-04 13:46:59
955
2
原创 vue使用v-for动态绑定div背景图片
以下为element ui的走马灯组件中插入div<template> <div class="block"> <span class="demonstration" >Hover </span> <el-carousel height="460px"> <el-carousel-item v-for="(item,i) in imgUrl" :key="i" > <div :
2021-03-16 15:42:53
2148
1
原创 mysql8.0忘记密码(ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES);)
muysql8.0+登陆报错:ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES);解决方案:管理员打开cmd=>先关闭mysql服务:net stop mysql将mysql设置为免密登录:mysqld --console --skip-grant-tables --shared-memory接下来登录mysql即可不需要密码,按回车进入:mysql -u root -p
2021-03-14 15:17:42
93
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人