发布时间:2022-08-13 文章分类:编程知识 投稿人:赵颖 字号: 默认 | | 超大 打印

git clone

git clone https://github.com/vuejs/core.git</h2>

安装pnpm 工具

npm ERR! code EUNSUPPORTEDPROTOCOL</p>
npm ERR! Unsupported URL Type "workspace:": workspace:*

在vue 目录下面创建index.html文件

<script src="https://www.cnblogs.com/mengxiangzhi/dist/vue.global.js" ></script>
<body>
    <div id="app">
    </div>
    <script>
        Vue.createApp({
            template:`
            <button @click="add">add</button>
            <ul> <li v-for="item in shop.lists" :key="item.id">{{item.text}}</li></ul>`,
            setup(){
                const shop=Vue.reactive({lists:[
                    {id:1,
                    text:'iphone'},
                    {id:2,
                    text:'xiaomi'}
                ]})
                const add=()=>{
                    shop.lists.push({id:Math.floor(Math.random()*100),text:'phone'+Math.floor(Math.random()*100)})
                }
                return{
                    add,
                    shop
                }
            }
        }).mount('#app')
    </script>
</body>

使用VS Code 插件 Live Server

Chrome DevTools