vue获取节点的父节点、兄弟节点、子节点
<span @click="getClickInfo(event)"> </span> getClickInfo: function (e) { let clickDom = e.currentTarget; // currentTarget 获取绑定点击事件的节点 let currentDom = e.target; // target 获取当前点击节点 let parent = clickDom.parentElement; // parentElement获取绑定事件节点的父节点 let previous = clickDom.previousElementSibling; // previousElementSibling获取绑定事件节点的前一个节点 let previousInner = previous.innerHTML; // 获取绑定...
vue3+vite3实现路由自动化
import {createRouter, createWebHashHistory} from 'vue-router' const modules = import.meta.glob('/src/pages/**/index.js'); console.log(modules); const routes = []; let components = []; Object.keys(modules).forEach(key => { let component = modules[key]; components.push(component()); let name = key.split('pages/')[1].split('/')[0].toLowerCase(); let path = "/" + name; if (name === 'index') { path = "/"; } ...
h5吹气互动(利用recorderjs获取输入音量大小)
h5吹气互动原理是利用获取麦克风音量,用一段逻辑来判断。研究了半天~ 最开始用的是下面这种方法(在ios下失效): <!doctype html> <html style="font-size: calc((100vw / 375)*10)"> <head> <meta charset="utf-8" ></meta> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" /> <title>Disney Spring Web - voice!</title> <script src="./recorder.mp3.min.js">&...