![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
魑魅魍魉魈
这个作者很懒,什么都没留下…
展开
-
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 · 629 阅读 · 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 · 1420 阅读 · 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 评论 -
KOA的基础使用
只是最基础的使用,很多特性都没有用上,准备用来部署vue打包后的dist文件废话不多说,直接上代码// 导入koa模块const Koa = require('koa');const Router = require('koa-router')// 创建koa的实例appconst koaBody = require('koa-body');const koaStatic = require('koa-static');const path = require('path');const原创 2021-11-12 17:51:54 · 674 阅读 · 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 · 307 阅读 · 0 评论