API
createFitScale(options)
target?: string | HTMLElement(default#app) — observation target element. A warning is logged if the element is not found.designHeight?: number(default1080)designWidth?: number(default1920)scaleMode?: 'height' | 'width' | 'auto'(defaultauto)
Returns the plugin object. Upon installation, it injects the global fitScale (a Ref<number>) into the app via provide and globalProperties.$fitScale.
useFitScale()
Get the current scale value as Ref<number> within a component.
FitPositionProps (TypeScript)
ts
export interface FitPositionProps {
scale?: number
top?: number
bottom?: number
left?: number
right?: number
unit?: string
}Dedicated Positioning Components
Includes <vfit-lt>, <vfit-rt>, <vfit-lb>, <vfit-rb>, <vfit-center>.
Corner Component Props:
<vfit-lt>:top,left,unit,scale,z<vfit-rt>:top,right,unit,scale,z<vfit-lb>:bottom,left,unit,scale,z<vfit-rb>:bottom,right,unit,scale,z
Center Component Props:
<vfit-center>:scale,z(auto-centered, no positioning props required)
All
vfit-*components use a shared.vfit-baseCSS class for common styles. Each component only specifies its owntransform-origin.
FitContainer Component
top/bottom/left/right?: numberunit?: 'px' | '%'(defaultpx)scale?: number(custom scale factor; pass0or omit to use globalfitScale)z?: number(default300)
Scaling Behavior
unit='px': All four sides (top/left/right/bottom) are multiplied by the scale value.unit='%': Position is unchanged, only content scales.transform-originis auto-detected based on which sides are specified.