随笔(1)
1、解除切屏限制命令
document.body.onblur = null
2、vue3
getCurrentInstance
import { getCurrentInstance } from 'vue'
const {proxy}= getCurrentInstance()
proxy.mittBus.emit('message',xxxx)
3、 自定义双向绑定,modelValue 就是对应输入框的值
emit('update:modelValue ' )
另一种写法:
defineModel() // 一个可以声明双向绑定属性的宏
4、 监听相关值得变化
const visible=computed({
get(){
return props.aaa
},
set(val){
peep.xxx = val
}
})
5、 删除对象的某个属性
Reflect.deleteProperty(target,key)
6、 动态样式使用v-bind设置
const treeWifth=props.width ?100% : 50%
<style>
width:v-bind(treeWidth);
</style>
7、 import.meta.glob(‘./zh/*•json’) 获取某个文件下的所有.json文件
8、git cherry–pick多分支开发,避免等待mr合并