index.ts 1.8 KB
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3 4 5 6 7 8 9 10 11 12
import {
  camelize,
  extend,
  hyphenate,
  normalizeClass,
  toDisplayString,
} from '@vue/shared'
import { vOn } from './vOn'
import { vFor, VForItem } from './vFor'
import { renderSlot } from './renderSlot'
import { withScopedSlot } from './withScopedSlot'
import { stringifyStyle } from './style'
fxy060608's avatar
fxy060608 已提交
13
import { dynamicSlot } from './dynamicSlot'
fxy060608's avatar
fxy060608 已提交
14
import { setRef } from './ref'
fxy060608's avatar
fxy060608 已提交
15
import { renderProps } from './renderProps'
16
import { withModelModifiers } from './withModelModifiers'
fxy060608's avatar
fxy060608 已提交
17

fxy060608's avatar
fxy060608 已提交
18
export { setupDevtoolsPlugin } from './devtools'
fxy060608's avatar
fxy060608 已提交
19

fxy060608's avatar
fxy060608 已提交
20 21
export { findComponentPropsData, pruneComponentPropsCache } from './renderProps'

22
export const o: typeof vOn = (value, key) => vOn(value, key)
fxy060608's avatar
fxy060608 已提交
23 24 25 26
export const f: typeof vFor = (
  source: any,
  renderItem: (...args: any[]) => VForItem
) => vFor(source, renderItem)
fxy060608's avatar
fxy060608 已提交
27
export const d: typeof dynamicSlot = (names) => dynamicSlot(names)
fxy060608's avatar
fxy060608 已提交
28 29
export const r: typeof renderSlot = (name, props, key) =>
  renderSlot(name, props, key)
fxy060608's avatar
fxy060608 已提交
30 31 32 33 34 35 36 37 38 39
export const w: typeof withScopedSlot = (fn, options) =>
  withScopedSlot(fn, options)
export const s: typeof stringifyStyle = (value) => stringifyStyle(value)

export const c: typeof camelize = (str) => camelize(str)
export const e: typeof extend = (target: object, ...sources: any[]) =>
  extend(target, ...sources)
export const h: typeof hyphenate = (str) => hyphenate(str)
export const n: typeof normalizeClass = (value) => normalizeClass(value)
export const t: typeof toDisplayString = (val) => toDisplayString(val)
fxy060608's avatar
fxy060608 已提交
40
export const p: typeof renderProps = (props) => renderProps(props)
fxy060608's avatar
fxy060608 已提交
41
export const sr: typeof setRef = (ref, id, opts) => setRef(ref, id, opts)
42 43 44 45 46
export const m: typeof withModelModifiers = (
  fn,
  modifiers,
  isComponent = false
) => withModelModifiers(fn, modifiers, isComponent)
47 48

export const j = (obj: unknown) => JSON.stringify(obj)