web-vue

复制代码
<html>
    <head>
        <title>永远朋友</title>
        <script src="../js/vue.js"></script>
    </head>
    <body>
        <div id = "app">
            <input type="text" v-model="message">
            {{ message }}
        </div>
    </body>
    <script>
        new Vue({
            el : "#app",
            data : {
                message:"hello vue!"
            }
        })
    </script>
</html>
复制代码
<html>
    <head>
        <script src = "../js/vue.js"></script>
    </head>
    <body>
         <div id="app"> 
            <a v-bind:href = "u">链接1</a>
            <a :href= "u">链接2</a>
            <input type="text" v-model="u">
         </div>
    </body>
    <script>
        new Vue({
            el:"#app",
            data:{
                u:"https://www.baidu.com"
            }
        })
    </script>
</html>
复制代码
<html>
    <head>
        <script src="../js/vue.js"></script>
    </head>
    <body>
        <div id = "app">
            <table border="1" cellspacing="0" width="60%">
                <tr>
                    <th>编号</th>
                    <th>姓名</th>
                    <th>年龄</th>
                    <th>性别</th>
                    <th>成绩</th>
                    <th>等级</th>
                </tr>
                <tr align="center" v-for="(user, index) in users">
                    <td>{{index+1}}</td>
                    <td>{{user.name}}</td>
                    <td>{{user.age}}</td>
                    <td><span v-if="user.gender == 2">女</span>
                        <span v-else="user.gender == 1">男</span></td>
                    <td>{{user.socre}}</td>
                    <td><span v-if="user.socre < 60" style="color: red;">不及格</span>
                          <span v-else-if="user.socre >= 60 && user.socre < 80">及格</span>
                        <span v-else="user.socre >= 80">优秀</span></tr>

                </tr>
            </table>
        </div>
    </body>
    <script>
        new Vue({
            el : "#app",
            data : {
                users:[{
                    name:"Tom",
                    age:18,
                    gender:1,
                    socre:99
                },{
                    name:"john",
                    age:19,
                    gender:2,
                    socre:79
                },{
                    name:"ave",
                    age:23,
                    gender:2,
                    socre:56
                } ]
            },
        })
    </script>
</html>
相关推荐
心.c8 分钟前
深拷贝浅拷贝
开发语言·前端·javascript·ecmascript
IT_陈寒38 分钟前
Vue 3.4性能优化实战:5个鲜为人知的Composition API技巧让打包体积减少40%
前端·人工智能·后端
前端九哥43 分钟前
💻【急招!27届前端实习生】广州4399实习太幸福了!江景+三餐+健身房全都有😭
前端·面试·招聘
咖啡の猫1 小时前
Vue全局事件总线
前端·javascript·vue.js
Lovereo1 小时前
我的目标检测性能优化之路:预算不够、GPU 没有、但性能我得要
前端
T___T1 小时前
JavaScript 变量声明详解:var、let、const 的核心差异
javascript·面试
蒙娜丽宁1 小时前
Rust 与 WebAssembly:构建高效前端应用的全流程复盘
前端·rust·wasm
这儿有一堆花1 小时前
使用 Actix-web 开发高性能 Web 服务
前端·数据库
豆苗学前端1 小时前
10分钟带你入门websocket,并实现一个在线多人聊天室
前端·javascript·后端
白水清风1 小时前
Vue3之渲染器
前端·vue.js·面试