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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
596 B
Markdown
Raw Normal View History

2018-10-27 03:44:50 +08:00
# @vue/runtime-test
2018-10-02 01:15:07 +08:00
This is for Vue's own internal tests only - it ensures logic tested using this package is DOM-agnostic, and it runs faster than JSDOM.
It can also be used as a reference for implementing a custom renderer.
```js
2019-11-29 03:43:12 +08:00
import { h, render, nodeOps, dumpOps } from '@vue/runtime-test'
2018-10-02 01:15:07 +08:00
2019-11-29 03:43:12 +08:00
const App = {
2025-09-15 10:18:59 +08:00
data() {
2018-10-02 01:15:07 +08:00
return {
2025-09-15 10:18:59 +08:00
msg: 'Hello World!',
2018-10-02 01:15:07 +08:00
}
2025-09-15 10:08:36 +08:00
},
2025-09-15 10:18:59 +08:00
render() {
2018-10-02 01:15:07 +08:00
return h('div', this.msg)
2025-09-15 10:18:59 +08:00
},
2018-10-02 01:15:07 +08:00
}
// root is of type `TestElement` as defined in src/nodeOps.ts
const root = nodeOps.createElement('div')
render(h(App), root)
const ops = dumpOps()
console.log(ops)
```