笔记
魑魅魍魉魈
这个作者很懒,什么都没留下…
展开
-
js原型和原型链详解
1、prototype和__proto__,constructor的关系假设现在定义两个类来替代构造函数class Parent { constructor(name){ this.name=name; }}class Child extends Parent { constructor(name,age){ super(name); this.age=age; }}const child = new Child("原创 2021-11-25 10:59:18 · 631 阅读 · 0 评论 -
div实现编辑器效果
<div contenteditable style="outline: none;"> <span style="user-select: all;"> Lorem ipsum dolor sitsafsdfasdfsdfasdf amet consectetur </span> <p>12ww3</p> <p>465</p> <div>divsdfsdf原创 2021-11-25 10:47:16 · 763 阅读 · 0 评论 -
依赖jquery的modal弹窗
最近维护一个PHP项目,那个bootStrap用的我头疼,有交互行为的组件或者方法还是自己简单写出来的顺手。不然维护起来实在太麻烦了。/** * 参数分别是传入的html字符串,宽,高,点透明处是否关闭,是否展示弹窗右上角的× */ const $modal = function (content='',width="400",height="300",waperClose=true,showArrow){ let div = document.createEle原创 2021-11-18 21:56:25 · 1422 阅读 · 0 评论 -
vue3 组件内使用路径
使用vite打包时不能将组件的路径进行编译。通过modules解决<template> <div class="t-img" v-bind="attr"> <img :src="src?.default" alt="" /> </div></template><script lang="ts" setup>import { defineProps, useAttrs, ref, onMounted } fro原创 2021-11-15 13:40:03 · 875 阅读 · 0 评论 -
简易懒加载
简易图片的懒加载函数function imgLazyLoad(evet:any = null) { const scrollTop = document.documentElement.scrollTop; const clientHeight = document.documentElement.clientHeight; imgs.value?.forEach((e) => { if ( e.parentElement && e.par原创 2021-11-15 13:37:01 · 356 阅读 · 0 评论 -
用extend替代vuex的方案
store/index.jsimport Vue from 'vue'const store = Vue.extend({ name: 'store', data() { return { count: 2, person: { name:'小明', age:23 } } }, methods:{原创 2021-10-19 17:50:44 · 313 阅读 · 0 评论 -
硬核开发工具
CodeIf : https://unbug.github.io/codelfDocsChina : https://www.docschina.organy-rule: http://github.com/any86/any-ruletool.lu: https://tool.lubaomitu: https://cdn.ba.原创 2021-08-21 21:56:30 · 3114 阅读 · 1 评论