标签:temp rip 函数式编程 ret function ted const turn oct
Composition API 纯函数式
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div id="app"></div> <script src="vue.global.js"></script> <script> // Composition API const App = { setup () { let state = Vue.reactive({name: ‘wyq‘, age: 18}); const other = function () { console.log(‘111‘); state.name = ‘点击了‘ }; Vue.onMounted(() => { console.log(‘dom加载完了‘) }); Vue.effect(() => { console.log(state.name) }) return { state, other } }, template: `<div @click="other">{{state.name}}</div>`, } Vue.createApp().mount(App, app) </script> </body> </html>
ts实现类型推断 函数式编程 响应式才是核心
Vue3.0基于Proxy 实现的数据更变检测 支持Composition API和Options API,以及typings
标签:temp rip 函数式编程 ret function ted const turn oct
原文地址:https://www.cnblogs.com/QQPrincekin/p/11972401.html