vue3-yuanma/packages/runtime-core/README.md

29 lines
790 B
Markdown
Raw Normal View History

2018-10-27 03:44:50 +08:00
# @vue/runtime-core
2018-09-19 23:35:38 +08:00
> This package is published only for typing and building custom renderers. It is NOT meant to be used in applications.
2018-09-20 12:17:20 +08:00
2019-09-07 00:58:31 +08:00
For full exposed APIs, see `src/index.ts`. You can also run `yarn build runtime-core --types` from repo root, which will generate an API report at `temp/runtime-core.api.md`.
## Building a Custom Renderer
2018-09-20 12:17:20 +08:00
``` ts
2019-12-10 03:03:10 +08:00
import { createRenderer } from '@vue/runtime-core'
2018-09-20 12:17:20 +08:00
2019-09-07 04:58:32 +08:00
const { render, createApp } = createRenderer({
2019-10-21 22:04:34 +08:00
patchProp,
2019-09-07 00:58:31 +08:00
insert,
remove,
createElement,
// ...
2018-09-20 12:17:20 +08:00
})
2019-09-07 04:58:32 +08:00
// `render` is the low-level API
// `createApp` returns an app instance with configurable context shared
// by the entire app tree.
export { render, createApp }
2019-09-07 00:58:31 +08:00
export * from '@vue/runtime-core'
2018-09-20 12:17:20 +08:00
```
2019-09-07 00:58:31 +08:00
See `@vue/runtime-dom` for how a DOM-targeting renderer is implemented.