惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
V
Visual Studio Blog
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MongoDB | Blog
MongoDB | Blog
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Engineering at Meta
Engineering at Meta
L
LangChain Blog
Martin Fowler
Martin Fowler
GbyAI
GbyAI
博客园 - 司徒正美

博客园 - 火军刀

创建测试表专用语句 基于Junit5的MockMvc单元测试基础方法 在指定目录下搜索文件名包含"项目"二字的Excel文件 启动Redis报错: # QForkMasterInit: system error caught. error code=0x00000070, message=CreateFileMapping failed.: no space on device eclipse为什么不允许查看包文件所在的目录? Hutool怎样指定日志工具 No matching distribution found for volcenginesdkarkruntime 如果你的idea右侧边栏和下边栏消失不见,没有了,不要惊慌 IDEA中使用腾讯云代码助手CodeBuddy 找到多个名为spring_web的片段 控制反转的通俗理解 Spring的pom.xml中的依赖 如果你的uniapp连不上手机 ollama可以不装在C盘,ollama安装时怎么选择路径? deepseek和千问是什么关系?DeepSeek-R1-Distill-Qwen-7B,这个模型中的deepseek和qwen是什么关系? properties对象 10种Java从数据库中取出数据的完整过程 用DOS命令删除子目录中所有文件名中包含“(1)”的文件 log4j.properties
Vue3写法
火军刀 · 2025-10-01 · via 博客园 - 火军刀
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3"></script>
</head>
<body>
    <div id="app">
        <h3>count的值为:{{state.count}}</h3>
        <button v-on:click="addCount">+1</button>
        <button @click="state.count+=1">+1</button>
        <button v-on:click="negativeCount">-1</button>
    </div>

    <!-- <script>
        const vm ={
            data:function(){
                return {
                    count:0
                }
            },
            methods:{
                addCount(){
                    this.count+=1
                }
            }
        }

        Vue.createApp(vm).mount('#app')
    </script> -->
    <script>
        const {createApp,reactive} = Vue;
        createApp({
            setup(){
                const state = reactive({
                    count:0
                })

                const addCount = ()=>{
                    state.count+=1
                }

                const negativeCount = ()=>{
                    state.count-=1
                }
                
                return {
                    state,
                    addCount,
                    negativeCount
                }
            }
        }).mount('#app');
    </script>
</body>
</html>

posted @ 2025-10-01 00:52  火军刀  阅读(16)  评论()    收藏  举报