- 博客(18)
- 收藏
- 关注
原创 在nuxt中配置vant按需加载并自定义主题
需要注意的是less-loader的版本,我使用的是npm install --save-dev less-loader@5.0.0nuxt.config.jsbuild: { transpile: [/vant.*?less/], babel: { plugins: [ [ 'import', { libraryName: 'vant', style: (name) =
2021-09-30 15:21:34
567
原创 xlsx删除行和列
function encodeCell(r, c) { return XLSX.utils.encode_cell({ r, c });} function deleteRow(ws, index) { const range = XLSX.utils.decode_range(ws['!ref']); for (let row = index; row < range.e.r; row++) { for (let col = range.s.c; c
2021-02-02 10:03:05
1061
原创 移动端1px
.retina-border { position: relative;}.retina-border::before { content: ''; position: absolute; width: 100%; height: 100%; transform-origin: left top; box-sizing: border-box; pointer-events: none; border-width: 1px; border-style: solid
2020-09-27 14:35:35
93
原创 vue高阶组件
vue一种高阶组件的写法,实际上就是父子两个组件,父组件负责数据模型,子组件负责视图渲染<div id="app"> <comp /></div>function http() { return new Promise((resolve, reject) => { setTimeout(() => { fetch('http://192.168.10.13:8765/name', { method: 'GET
2020-09-11 13:58:14
330
原创 nuxt.config.js配置postcss-pxtorem插件以及静态站点打包配置
const buildDir = "dist"export default { /* ** Build configuration ** See https://nuxtjs.org/api/configuration-build/ */ build: { // postcss配置插件postcss-pxtorem,npm i -D postcss-pxtorem postcss: { plugins: { "postcss-pxto
2020-07-27 09:44:10
1214
原创 ckeditor5图像上传,自定义上传适配器
因为本项目是基于vue.js开发的一个SPA,所以使用了ckeditor5官方提供的vue component,图片上传需要添加Simple upload adapter插件才能工作,但是在vue component中配置的编辑器类型是build过后的,和Simple upload adapter插件两者都引入了相同的模块,导致报重复引入模块的错误,于是参照官网的自定义适配器教程,实现了一个upload adapter。1.安装vue组件和编辑器npm install --save @ckeditor/
2020-07-08 11:39:23
1967
1
原创 JavaScript数组的扁平化
flat方法var arr1 = [1, 2, [3, 4]];arr1.flat(); // [1, 2, 3, 4]var arr2 = [1, 2, [3, 4, [5, 6]]];arr2.flat();// [1, 2, 3, 4, [5, 6]]var arr3 = [1, 2, [3, 4, [5, 6]]];arr3.flat(2);// [1, 2, 3, 4, 5, 6]//使用 Infinity,可展开任意深度的嵌套数组var arr4 = [1, 2, [
2020-07-01 11:46:13
178
原创 node.js搭建图片上传服务器
const express = require("express");const fs = require("fs");const formidable = require("formidable");const bodyParser = require("body-parser");const path = require("path");const rootPath = require("app-root-path");const { v4: uuidv4 } = require("uuid
2020-06-29 15:12:20
842
原创 node.js搭建文件服务器
const http = require("http");const url = require("url");const fs = require("fs");const path = require("path");const mime = { css: "text/css", gif: "image/gif", html: "text/html", ico: "image/x-icon", jpeg: "image/jpeg", jpg: "image/jpeg",
2020-06-29 15:07:58
668
原创 滚动穿透解决方法
滚动穿透解决方法(在nutui组件库上get到的)let scrollTop = 0;let maskVisible = true;if (maskVisible) { // 遮罩层显示时 scrollTop = document.scrollingElement.scrollTop || document.body.scrollTop; Object.assign(document.body.style, { position: "fexed", top: -scroll
2020-06-28 18:10:21
416
原创 对象作为属性——JavaScript中toString的隐式调用
将对象作为属性时,会默认调用对象的toString方法,如果覆写了toString方法并返回了值,那么就使用返回值作为属性名;如果没有覆写toString方法,将返回[object Object]作为属性名,所以使用对象p作为属性名时,使用对象b一样可以拿到存储在属性p上的属性值const o = { toString: function () { console.log("toString called"); return "toString"; },};const p =
2020-06-28 17:56:23
737
原创 JavaScript图片压缩并下载
<input type="file" onChange="onChange(event)" />function onChange(e) { const input = e.target; const files = input.files; const file = files[0]; if (!file) return; const name = file.name; // 必须是图片类型 const type = file.type; console
2020-05-30 23:27:24
422
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人