跳到主要内容

useZoomFactor

分类
导出大小
322 B
@vueuse/electron
上次更改
8 个月前

响应式的 WebFrame 缩放因子。可在 @vueuse/electron 附加组件中使用。

用法

ts
import { 
useZoomFactor
} from '@vueuse/electron'
// enable nodeIntegration if you don't provide webFrame explicitly // see: https://electron.js.cn/docs/api/webview-tag#nodeintegration // Ref result will return const
factor
=
useZoomFactor
()
console
.
log
(
factor
.
value
) // print current zoom factor
factor
.
value
= 2 // change current zoom factor

立即设置初始缩放因子

ts
import { 
useZoomFactor
} from '@vueuse/electron'
const
factor
=
useZoomFactor
(2)

传入一个 ref,当源 ref 改变时,因子将会更新

ts
import { 
useZoomFactor
} from '@vueuse/electron'
import {
shallowRef
} from 'vue'
const
factor
=
shallowRef
(1)
useZoomFactor
(
factor
) // zoom factor will match with the ref
factor
.
value
= 2 // zoom factor will change

类型声明

ts
export declare function 
useZoomFactor
(
factor
:
MaybeRef
<number>):
Ref
<number>
export declare function
useZoomFactor
(
webFrame
:
WebFrame
,
factor
:
MaybeRef
<number>,
):
Ref
<number>
export declare function
useZoomFactor
(
webFrame
:
WebFrame
):
Ref
<number>
export declare function
useZoomFactor
():
Ref
<number>

来源

源代码文档

贡献者

Anthony Fu
IlyaL
SerKo
Anthony Fu
ArcherGu

更新日志

v12.8.0
7432f - feat(types): 废弃 MaybeRefMaybeRefOrGetter,转而使用 Vue 的原生类型 (#4636)
0a9ed - feat!: 放弃对 Vue 2 的支持,优化打包并清理 (#4349)
v10.7.0
fccf2 - feat: 升级依赖 (#3614)

根据 MIT 许可证发布。