纵有疾风起,人生不言弃
1234567891011121314
const app = { render(context){ effectWatch(()=>{ // ... }) }, setup(){ const state = reactive({ count: 0 }) return { state } }}app.render(app.setup())
123456789101112
import {effectWatch} from "reactivity"export function createApp(rootComponent){ return { mount(rootContainer){ const context = rootComponent.setup() effectWatch(()=>{ const element = rootComponent.render(context) rootContainer.append(element) }) } }}