Skip to content

像素尺寸

像素点尺寸由全局 CSS 变量 --px-bit 控制,默认 4px,目前只支持 2px 和 4px,其他尺寸暂未经过充分测试。

setPixelSize

你可以在任何地方,不管是入口文件还是业务代码中,通过导出的 setPixelSize 函数来修改像素尺寸。

ts
import { setPixelSize } from '@pixelium/web-vue'
// If on-demand import
// import { setPixelSize } from '@pixelium/web-vue/es'

setThemeColor(2) // 2px

可以在这里试一下:

<template>
	<px-space>
		<px-button @click="set()">Set Pixel Size to 2px</px-button>
		<px-button @click="reset()" theme="info">Reset</px-button>
	</px-space>
</template>
<script setup lang="ts">
import { setPixelSize, resetPixelSize } from '@pixelium/web-vue'

const set = () => {
	setPixelSize(2)
}
const reset = () => {
	resetPixelSize()
}
</script>