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

推荐订阅源

C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
IT之家
IT之家
V
Visual Studio Blog
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
大猫的无限游戏
大猫的无限游戏
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
D
Docker
MyScale Blog
MyScale Blog
小众软件
小众软件
云风的 BLOG
云风的 BLOG
美团技术团队
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 【当耐特】

博客园 - 火军刀

创建测试表专用语句 基于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)  评论()    收藏  举报