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>
相关推荐
星环科技10 分钟前
数据标准Agent ,让企业数据说同一种语言
java·开发语言·前端
橘子星16 分钟前
深入理解 AJAX 中的 JSON 序列化与 JS 异步处理
前端·javascript·后端
旧曲重听120 分钟前
2026前端技术从「夯」到「拉」
前端·程序人生·职场和发展·软件工程
Kapaseker20 分钟前
我找到了最适合程序员的 PPT 工具 — Slidev
前端
夏幻灵25 分钟前
深度解析 JavaScript 异步编程:从回调地狱到 Promise 的重构
开发语言·javascript·重构
雾削木37 分钟前
B语言经典教程现代化重构
java·前端·stm32·单片机·嵌入式硬件
Cobyte39 分钟前
20.Vue Vapor 的应用初始化
前端·javascript·vue.js
乘风gg43 分钟前
手把手带你实践历时一年总结的 AI Code Review 最佳工作流!
前端·ai编程·cursor
禅思院43 分钟前
POST请求发两次?一次讲透CORS预检机制,面试不再翻车
前端·架构·前端框架
IT_陈寒1 小时前
SpringBoot自动配置这么智能,为啥我写的Bean注入不了?
前端·人工智能·后端