Vue3 Script Setup 代码示例:使用 ref 和 function
<div id='app'></div>
<script>
const { ref } = Vue;
const App = {
setup() {
const count = ref(0);
function increment() {
count.value++;
}
function decrement() {
count.value--;
}
return {
count,
increment,
decrement
};
}
};
Vue.createApp(App).mount('#app');
</script>
原文地址: https://www.cveoy.top/t/topic/mCYU 著作权归作者所有。请勿转载和采集!