当前位置:   article > 正文

Vue.js高效前端开发(页面验证跳转,查)

Vue.js高效前端开发(页面验证跳转,查)

   效果图

 

 

 

 

 

 代码:

new.html

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <div id="app">
  9. <input type="text" name="" id="" v-model="userName"/><br>
  10. <input type="text" name="" id="" v-model="pwd"/><br>
  11. <button @click="cha()">跳转</button>
  12. </div>
  13. <script src="js/vue.js"></script>
  14. <script>
  15. var vm=new Vue({
  16. el:"#app",
  17. data:{
  18. userName:"1",
  19. pwd:"2"
  20. },
  21. methods:{
  22. cha:function(){
  23. if (this.userName=="admin"&&this.pwd=="123456") {
  24. location.href="./Seek.html"
  25. } else{
  26. console.log("登录失败")
  27. }
  28. }
  29. }
  30. })
  31. </script>
  32. </body>
  33. </html>

seek.html

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <h1>异兽信息列表</h1>
  9. <div id="app">
  10. <input type="text" name="" id="" v-model="keyword">
  11. <table border="1">
  12. <tr>
  13. <th>编号</th>
  14. <th>名称</th>
  15. <th>攻击力</th>
  16. <th>简介</th>
  17. </tr>
  18. <tr v-for="(item,index) in relist.length>0?relist:shou" >
  19. <td>{{item.id}}</td>
  20. <td>{{item.name}}</td>
  21. <td>{{item.gongjili}}</td>
  22. <td>{{item.jianjie}}</td>
  23. </tr>
  24. </table>
  25. </div>
  26. <script src="js/vue.js"></script>
  27. <script>
  28. var Vue=new Vue({
  29. el:"#app",
  30. data:{
  31. keyword:"",
  32. relist:[],
  33. shou:[{
  34. id:1,
  35. name:"困",
  36. gongjili:12,
  37. jianjie:"困是打怪兽"
  38. },
  39. {
  40. id:2,
  41. name:"食铁兽",
  42. gongjili:123,
  43. jianjie:"驱蚊器二群无的群多无群无多"
  44. },
  45. {
  46. id:3,
  47. name:"困",
  48. gongjili:1234,
  49. jianjie:"15气温气温气温耳热与法国代购"
  50. }
  51. ]
  52. },
  53. watch:{
  54. keyword:function(newVal,oldVal){
  55. var ret =this.shou.filter(m=>m.name.toString().includes(newVal.toString()));
  56. this.relist=ret;
  57. }
  58. }
  59. })
  60. </script>
  61. </body>
  62. </html>

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/418107
推荐阅读
相关标签
  

闽ICP备14008679号