- 博客(20)
- 收藏
- 关注
原创 js设置页面水印
const setWatermark = (str) => { const id = '1.23452384164.123412416'; if (document.getElementById(id) !== null) document.body.removeChild(document.getElementById(id)); const can = document.createElement('canvas'); can.width = 200; can.height = 130;
2022-05-20 11:26:42 591
原创 web3实例化
// getWeb.jsimport web3 from 'web3'let hasProviderEnded = false;export function newBlockchainConnection(webSocketProvider) { const web3Instant = new web3(webSocketProvider) window.web3 = web3Instant; hasProviderEnded = false; let provider = web3Ins
2022-05-19 14:49:48 364
原创 miniprogram-ci一键获取小程序预览二维码
miniprogram-ci一键获取小程序预览二维码可以用npm init初始化一个新项目插件安装// 安装 expresscnpm install express --save// 安装 miniprogram-cicnpm install miniprogram-ci --save根目录创建index.jsconst preview = require(`./preview`)const express = require('express')var fs = require('f
2021-12-07 10:41:33 1035
原创 优雅的axios封装
项目src目录下创建http文件夹包含 service.js axios.js api.js url.js四个js文件// service.js// 拦截器import axios from 'axios';import Vue from 'vue'//获取tokenfunction getToken() { //假设token存储与cookies中 return Vue.$cookies.get('token')}//创建axios实例let service = ax
2021-08-10 11:07:59 271
原创 uni请求封装
import Config from './config.js'export default { sendRequest(params) { var method = params.data != undefined ? 'POST' : 'GET', // 请求方式 url = Config.baseUrl + params.url, // 请求路径 data = { // 请求常量参数可省略 data }; // token if (uni.getStor
2021-07-06 09:56:09 190
原创 js 节流防抖
/** * 函数防抖 (只执行最后一次点击) * @param fn * @param delay * @returns {Function} * @constructor */export const Debounce = (fn, t) => { let delay = t || 500; let timer; return function () { let args = arguments; if(timer){ clearTimeout(
2021-07-06 09:24:23 128
原创 uniapp工具函数封装
页面跳转export default { /** * 页面跳转 * @param {string} to 跳转链接 /pages/index/index * @param {Object} param 参数 {key : value, ...} * @param {string} mode 模式 */ redirectTo(to, param, mode) { let url = to; // tabbar数组 let tabbarList = ['/pages/in
2021-07-05 10:39:42 690
原创 UniPush消息推送, 安卓ios开箱即用
UniPush消息推送, 安卓ios接收,点击完整版APP.vueAPP.vueonLaunch()内// 获取cidvar info = plus.push.getClientInfo();console.log('info', JSON.stringify(info));let osname = plus.os.name;if (osname == 'Android') { uni.onPush({ provider: 'unipush', success: function()
2021-07-05 09:43:31 339
原创 echart按需加载
var appInfo = { echartsIsReady: '', echartsUrl: 'https://cdn.bootcdn.net/ajax/libs/echarts/3.5.4/echarts.min.js'}// appInfo.echartsUrl是echarts.js的网络地址// appInfo.echartsIsReady是echarts.js是否加载完毕的标识位const checkReady = () => { return new Promise(
2021-01-18 13:56:29 511
原创 vue WebSocket及重连封装
let Socket = ''let setIntervalWesocketPush = nulllet url = ''// 建立连接export function createSocket (urls) { url = urls if (!Socket) { console.log('建立websocket连接') clearInterval(setIntervalWesocketPush) Socket = new WebSocket(urls) Soc
2021-01-18 13:48:00 1732 1
原创 vue控制按钮权限
获取完用户权限后,把所有权限以数组的方式存入store中 ["106", "10602", "perm:edit", "home:user:login", "perm:add", "perm:delete", "home:user:monthNew", "home:user:monthActive", "perm:list", "security:manage", "10601", "perm:role-oper:delete", "perm:role-oper:edit", "perm:role-ope
2020-09-02 19:15:04 1298
原创 element upload图片上传七牛及vue外部引入js方法
element uplod图片上传七牛 <el-upload action :accept="acceptImages" :multiple="true" :auto-upload="false" list-type="picture-card" ...
2019-09-19 21:50:28 283
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人