@{
Layout = null;
}

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>学生列表</title>
    <script src="https://cdn.bootcss.com/vue/2.4.2/vue.min.js"></script>
    <style type="text/css">
      .bg{
        background:red;
      }
    </style>
  </head>
  <body>
    <div id="demo">
      <label>姓名</label> <input type="text" id="name" v-model="name"/>
      <label>性别</label> <input type="text" id="gender" v-model="gender"/>
      <label>年龄</label> <input type="text" id="age" v-model="age"/>
      <label>爱好</label> <input type="text" id="hobby" v-model="hobby"/>
      <button v-on:click="AddStuList">添加</button>
      <table border="1" cellspacing="5" cellpadding="5" v-show="stuList.length">
        <caption><h3>学生列表</h3></caption>
        <tr>
          <th>状态</th>
          <th>学号</th>
          <th>姓名</th>
          <th>性别</th>
          <th>年龄</th>
          <th>爱好</th>
          <th>操作</th>
        </tr>
        <tr v-for="(item,index) in stuList" :class="{bg:item.isChecked}">
          <td><input type="checkbox" name="" id="" value="" v-model="item.isChecked"/></td>
          <td>{{index+1}}</td>
          <td>{{item.name}}</td>
          <td>{{item.gender}}</td>
          <td>{{item.age}}</td>
          <td>{{item.hobby}}</td>
          <td><button v-on:click="delStuList(item)">删除</button></td>
        </tr>
      </table>
    </div>
    <script>
    var list=[
      {
        name:"张三",
        gender:"男",
        age:"12",
        hobby:"睡觉",
        isChecked:false
      },
      {
        name:"张三",
        gender:"男",
        age:"12",
        hobby:"睡觉",
        isChecked:false
      }
     ];

    var vm=new Vue({
        el:"#demo",
        data:{
          stuList:list,
          name:"",
          gender:"",
          age:"",
          hobby:"",
          isChecked:""
        },
        methods:{
          AddStuList:function(){
            var stu={
                name:this.name,
                gender:this.gender,
                age:this.age,
                hobby:this.hobby,
                isChecked:this.isChecked
              }
            this.stuList.push(stu);
            this.name='';
            this.gender='';
            this.age='';
            this.hobby='';
            isChecked='';
          },
         delStuList:function(item){
            var index=this.stuList.indexOf(item);
            this.stuList.splice(index)
          }
        }
      });
    </script>
</body>

</html>

 

Asp.net MVC + Vue.js的更多相关文章

  1. ASP.NET MVC+Vue.js实现联系人管理

    接触了一天vue.js,简单浏览了一本关于vue的电子书,就开始动手使用ASP.NET MVC和Vue.js开发一个联系人管理的小程序. 先看一下这个联系人管理的小程序的界面,也就是我们大概要实现什么 ...

  2. asp.net mvc + vue.js + axios.js

    1.新建一个 MVC 应用程序 2.右键解决方案 添加VUE 3.搜索vue 1.安装axios.js ,用于数据请求,get , post axios

  3. ASP.NET Core + Vue.js 开发

    1.新建 项目文件夹 pro,在 VS CODE 打开终端,输入dotnet new mvc 命令,新建asp.net core项目. 2.在Startup.cs添加webpack的引用与配置 usi ...

  4. MVC + Vue.js 初体验(实现表单操作)

    Vuejs http://cn.vuejs.org/ Vue.js(读音 /vjuː/, 类似于 view) 是一套构建用户界面的 渐进式框架.与其他重量级框架不同的是,Vue 采用自底向上增量开发的 ...

  5. [Asp.net Mvc]为js,css静态文件添加版本号

    方式一: 思路 string version = ViewBag.Version; @Scripts.RenderFormat("<script type=\"text/ja ...

  6. Asp.net MVC Vue Axios无刷新请求数据和响应数据

    Model层Region.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; ...

  7. Asp.Net MVC 中JS通过ajaxfileupload上传图片获取身份证姓名、生日、家庭住址等详细信息

    客户要求用身份证图片上传获取身份证的详细信息就下来研究了一下(现在的客户真的懒 身份证信息都懒得输入了哈哈...),经过慢慢研究,果然皇天不负有心人搞出来了.这个借助的是腾讯的一个SKD  腾讯优图云 ...

  8. AspNetCore MVC + Vue.Js 项目搭建

    1.准备 全文重点在于搭建环境,其他相关知识点请百度. VS2017 升级到最新的版本 安装 net core 2.0 安装 npm (npm相关使用请百度或咨询前端小伙伴) 全局安装 webpack ...

  9. 【转】asp.net mvc css/js压缩合并 --- combres

    转自:http://www.cnblogs.com/zxktxj/archive/2012/05/30/2526246.html NuGet   网站:http://nuget.codeplex.co ...

随机推荐

  1. Qt & opencv 学习(一)

    Qt也没怎么系统学过,opencv也没系统学过.慢慢来,一步一步弄清楚吧. 天嵌科技有个文档,先去看这个文档,主要是开发环境的配置.文档名字就是QT应用程序开发手册-20150918.pdf.在QT里 ...

  2. ActiveMQ P2P模型 观察者消费

    生餐者: package clc.active.listener; import org.apache.activemq.ActiveMQConnectionFactory; import org.t ...

  3. HDU 2444 The Accomodation of Students(判断二分图+最大匹配)

    The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  4. 数据结构之 排序---折半插入排序(时间复杂度 O(nlog2 n) )

    排序 Time Limit: 1000MS Memory limit: 32678K 题目描述 给你N(N<=100)个数,请你按照从小到大的顺序输出. 输入 输入数据第一行是一个正整数N,第二 ...

  5. codeforces 433C. Ryouko's Memory Note 解题报告

    题目链接:http://codeforces.com/problemset/problem/433/C 题目意思:一本书有 n 页,每页的编号依次从 1 到 n 编排.如果从页 x 翻到页 y,那么| ...

  6. hdu-5675 ztr loves math(数学)

    题目链接: ztr loves math  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Othe ...

  7. 西交校赛 I. GZP and CS(数位dp)

    I. GZP and CS GZP love to play Counter-Strike(CS). One day GZP was playing a mod of CS. The counter- ...

  8. 并不对劲的bzoj1758:p4292:[WC2010]重建计划

    题目大意 \(n\)(\(n\leq10^5\))个点的一棵树,有边权\(w\),给定\(l,r\),求边数在\([l,r]\)中的路径的平均边权的最大值 题解 二分答案,判断时将边权变成\(w-mi ...

  9. SPOJ:Robot(数学期望)

    There is a robot on the 2D plane. Robot initially standing on the position (0, 0). Robot can make a ...

  10. [SoapUI] Common XPath expressions

    选取节点 表达式 描述 nodename 选取此节点的所有子节点. / 从根节点选取. // 从匹配选择的当前节点选择文档中的节点,而不考虑它们的位置. . 选取当前节点. .. 选取当前节点的父节点 ...