前端js
凉臣
人们梦想远方迷人的玫瑰园,却不去欣赏盛开在窗前的玫瑰花
展开
-
浅谈es6中await和async
目录1. 解释async和await2.async的作用3. await等待4.await到底能干啥1. 解释async和awaitasync是异步的简写,用于声明一个函数是异步执行。await用于等待一个异步方法执行完毕。 await只能用于async函数中2.async的作用async输出的是一个 Promise 对象,如图我们测试一下。async function test(){ return 123;}console.log(test());..原创 2022-03-20 22:16:54 · 7828 阅读 · 7 评论 -
uniapp中使用vuex实现缓存登录信息
1.在根目录下新建store目录,store中新建index.js,如图2.index.js代码如下import Vue from 'vue'import Vuex from 'vuex'Vue.use(Vuex)const store = new Vuex.Store({ state: { uerInfo: {}, hasLogin: false, getMsg: {}, adduser: {}, addgroup: {}, msgboxuser:..原创 2021-08-25 18:27:08 · 3218 阅读 · 0 评论 -
使用svg绘制可拖拽的贝塞尔曲线,并且长按线可以增加动态点
核心代码 const getDistance = (p1, p2) => { return Math.sqrt( Math.pow(p1.x + p2.x, 2) + Math.pow(p1.y + p1.y, 2) ) } const getControlpoint = (point, point1, poin原创 2021-08-25 17:35:38 · 1508 阅读 · 5 评论