摘要: 开篇解释一下async /await 与 Primise的关系 async/await是Promise的语法糖所以这里我会直接使用async/await替换Promise let result = await func() // => 等价于 func().then(result => { // c 阅读全文
posted @ 2021-11-19 14:23 Mica 阅读(2692) 评论(1) 推荐(1) 编辑
摘要: 关于Vue3里面的getCurrentInstance:可以获取挂载在全局的属性和获取上下文 这里会碰到几个问题: 一、不能使用getCurrentInstance的ctx 我们在获取Vue3中全局挂载的方法时会这么写: 这里的ctx不是setup提供的ctx const { ctx } = get 阅读全文
posted @ 2021-05-11 17:32 Mica 阅读(7172) 评论(2) 推荐(3) 编辑
摘要: 最近用vue3 重构vue2.x的项目,真是一坑未平,一波又起,话不多说 上代码 <template> <div>{{ loadingStatus }}</div> </template> ... setup(props, context) { // @ts-ignore const { proxy 阅读全文
posted @ 2021-05-11 15:47 Mica 阅读(2252) 评论(0) 推荐(0) 编辑
摘要: 子组件 child.vue <template> <div> <p>hello world</p> <button @click="handleClick">click</button> </div> </template> <script lang="ts"> import { defineCom 阅读全文
posted @ 2021-05-11 15:14 Mica 阅读(988) 评论(0) 推荐(0) 编辑
摘要: 大家应该平时涉及到查询基本上都是调用后端接口就完事,传入字符串~调用接口~返回数据~~~ 但是不少场景也需要前端自己做匹配查询 那么今天就简单做一个吧! 废话不多说 直接上代码: 1. 封装方法: export function filterSearch({ oldList = [], search 阅读全文
posted @ 2021-02-23 17:24 Mica 阅读(1362) 评论(0) 推荐(0) 编辑
摘要: 最近使用uniapp涉及到一个上传图片的功能,原本看官方文档api觉得没问题,正常开发, 1. 首先微信端没问题 uni.getFileSystemManager().readFile({ filePath: url, //选择图片返回的相对路径 encoding: "base64", //编码格式 阅读全文
posted @ 2020-12-16 10:04 Mica 阅读(1364) 评论(0) 推荐(1) 编辑
摘要: <input type="file" accept="image/*" capture="camera"> <input type="file" accept="video/*" capture="camcorder"> <input type="file" accept="audio/*" cap 阅读全文
posted @ 2020-07-01 08:59 Mica 阅读(5615) 评论(0) 推荐(0) 编辑
摘要: 最近碰到一个常见的需求,今天来整理一下思路 点击锚点 页面滚动到指定位置,这个很常见 当需要滚动页面的时候 点击栏(菜单栏) 同步展示高亮 这个怎么完成呢? 话不多说 贴代码 1. 这是头部点击跳转部分 <template> <div class="privilege-head"> <ul> <li 阅读全文
posted @ 2020-04-14 17:36 Mica 阅读(2935) 评论(0) 推荐(1) 编辑
摘要: !-- 这里为你提供了三种动态加载js的jquery实例代码哦,由于jquery是为用户提供方便的,所以利用jquery动态加载文件只要一句话$.getscript("test.js");就ok了。 <!doctype html public "-//w3c//dtd xhtml 1.0 trans 阅读全文
posted @ 2019-12-09 09:18 Mica 阅读(855) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-12-05 09:34 Mica 阅读(3533) 评论(0) 推荐(0) 编辑