import{At as e,E as t,Ot as n,Xt as r}from"./chunks/framework.ECw2lWOt.js";var i=JSON.parse(`{"title":"工具函数","description":"","frontmatter":{},"headers":[],"relativePath":"runtime-api/core/utils.md","filePath":"runtime-api/core/utils.md"}`),a={name:`runtime-api/core/utils.md`};function o(t,i,a,o,s,c){return r(),n(`div`,null,[...i[0]||=[e(`

工具函数

@tmagic/core 导出的工具函数。

style2Obj

typescript
import { style2Obj } from '@tmagic/core';

const styleObj = style2Obj('width: 100px; height: 200px;');
console.log(styleObj); // { width: '100px', height: '200px' }

fillBackgroundImage

typescript
import { fillBackgroundImage } from '@tmagic/core';

const bg = fillBackgroundImage('https://example.com/image.png');
console.log(bg); // 'url(https://example.com/image.png)'

getTransform

transformStyle

typescript
import { transformStyle } from '@tmagic/core';

const style = transformStyle({ width: 100, height: 200 }, 'browser');
console.log(style); // { width: '1rem', height: '2rem' }

常量

COMMON_EVENT_PREFIX

COMMON_METHOD_PREFIX

typescript
import { COMMON_EVENT_PREFIX, COMMON_METHOD_PREFIX } from '@tmagic/core';

const eventKey = \`\${COMMON_EVENT_PREFIX}click\`;
const methodKey = \`\${COMMON_METHOD_PREFIX}show\`;
`,19)]])}var s=t(a,[[`render`,o]]);export{i as __pageData,s as default};