uni-app 动态导入图片

uni-app动态引入图片,:src,一定要放在根目录/static/下,别的目录都不好使,而且不能是@/src

const src = '/static/xxx.png'
<image :src="src" />

前端面试题目、初稿

初稿

JS 基础

1. 说一下计时器为什么计时不准?
2. 说一下`Promise.all``Promise.race``Promise.allSettled`的区别?
3. 对象的深拷贝,`JSON.parse(JSON.stringify())`有什么弊端?
4. `ES6``reduce`的四个参数,如何扁平化数组?
5. `WeakMap``Map`有什么区别,应用场景?为什么`WeakMap``key`只能是`Obj`
阅读更多

Vue3 uni-app watch 监听不到、不生效

有这么一个场景,A页面跳转到B页面,然后A页面监听了一个Store,然后B页面修改Store,再切回来,A页面竟然监听不到?

他喵 🐱 的,watch了半天,不生效,不知道什么鬼。

watch(
[
pickTicketStore.ship,
userStore.user,
pickTicketStore.isOnlySupportManualPay,
],
([ship, user, isOnlySupportManualPay]) => {
// Do something with ship, user, isOnlySupportManualPay
},
{ immediate: true }
);
阅读更多

macOS markdown 转 docx

一行代码直接搞定:

➜  ~ pip3 install pypandoc
Collecting pypandoc
Downloading pypandoc-1.15-py3-none-any.whl.metadata (16 kB)
Downloading pypandoc-1.15-py3-none-any.whl (21 kB)
Installing collected packages: pypandoc
Successfully installed pypandoc-1.15
➜  ~ python3 -c "import pypandoc; pypandoc.convert_text(open('input.md').read(), 'docx', format='md', outputfile='output.docx', extra_args=['--standalone'])"