vue模拟测试

input组件:

<template>
    <div id="myintput">
      <div id="search">
          <div>产品名称</div>
          <div><input type="text" placeholder="请输入产品名称" v-model="name"></div>
      </div>
      <div id="error">{{errormsg}}</div>
      <div id="submit"><input type="button" value="录入" @click="checkdata"></div>
    </div>
</template>

<script>
export default {
  name: 'MyIntput',
  data(){
    return {
      name:'',
      errormsg:''
    }
  },

  methods:{
    checkdata(){
      if (this.name == '') {
        this.errormsg = '此产品为空'
      } else if(/\d/.test(this.name)){
        this.errormsg = '产品中不能含有数字'
      } else {
        this.$router.push('/MyProduct') 
      }
    }
  }
}
</script>

<style scoped>
  div {
    font-size: 14px;
  }

  #search {
    display: flex;
  }

  #search input {
    width: 150px;
  }

  #search div:first-child {
    float: left;
    width: 100px;
    margin-right: 10px;
    text-align: right;
  }

  #submit input{
      width: 268px;
  }

  #error{
    color:#ff0000;
  }
  
</style>

product组件:

<template>
    <div>
        <div>
            <input type="text" id="product" placeholder="请输入产品名称"> 
            <input type="button" id="search" value="搜索" @click="getData">
        </div>
        <div id="product">
            <table>
                <tr>
                    <th></th>
                    <th>品牌</th>
                    <th>型号</th>
                    <th>价格</th>
                </tr>
                <tr v-for="item in list" :key="item">
                    <td><img :src='"http://114.67.241.121:8080/img/" + item.image'></td>
                    <td>{{ item.brand }}</td>
                    <td><a :href='"http://114.67.241.121:8080/img/" + item.image'>{{ item.model }}</a></td>
                    <td>{{ item.price }}</td>
                </tr>
            </table>
        </div>
    </div>
</template>

<script>
export default {
    data(){
        return {
            list:[]
        }
    },
    methods: {
        getData() {
            this.axios({
                method: 'get',
                url: 'http://114.67.241.121:8080/product/list'
            }).then(res => {
                console.log(res)
                this.list = res.data.data
            })
        }
    }
}
</script>

<style>
    table{
    border: 1px solid #000;
    border-collapse: collapse;
    width: 550px;
}
th {
    height: 30px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #000;
}

td {
    height: 100px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #000;
}

img {
    width: 100px;
    height: 100px;
}
a{
    color:#00ff00;
}
a:hover{
    color:#ff0000;
}
tr th:nth-child(1){
    width: 100px;
}
tr th:nth-child(2){
    width: 150px;
}
tr th:nth-child(4){
    width: 150px;
    background-color: #ffffd0;
}
tr td:nth-child(4){
    background-color: #ffffd0;
}
</style>

router文件下的index.js配置路由:

import Vue from 'vue'
import VueRouter from 'vue-router'
import MyIntput from '@/components/MyIntput'
import MyProduct from '@/components/MyProduct'


Vue.use(VueRouter)

const router = new VueRouter({
    routes:[
        //配置路由的路径
        {
            path:'/',
            component:MyIntput
        },
        {
            path:'/MyProduct',
            component:MyProduct
        }
    ]
})
export default router

main.js:

import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
import axios from 'axios'

Vue.config.productionTip = false

Vue.prototype.axios=axios

new Vue({
  axios,
  router,
  template: '<App/>',
  render: h => h(App)
}).$mount('#app')

app组件:

<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>



export default {
  name: 'App',
}
</script>

<style>

</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
【资源说明】 基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip 基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip 基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip 基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip基于Vue+JavaScript的驾校模拟考试练习的前端源码(课程大作业).zip 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可直接用于毕设、课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
【资源说明】 1、基于SpringBoot+Vue 驾校理论课模拟考试系统(自动化部署)源码+项目说明.zip 2、该资源包括项目的全部源码,下载可以直接使用! 3、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考资料学习借鉴。 4、本资源作为“参考资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研,自行调试。 基于SpringBoot+Vue 驾校理论课模拟考试系统(自动化部署)源码+项目说明.zip ## 驾校理论课模拟考试系统 ## 工具 Git Npm Lombok ## CI/CD **具体部署流程看/ServerDeploy/服务器部署流程.txt** Jenkins + Docker 持续集成 ![11](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%8715.png) ### 技术栈 1.后端: ​ 权限控制:SpringSecurity + JWT ​ Ioc框架:SpringBoot ​ 持久层:MybatisPlus + Spring Data JPA ​ 缓存:Redis ​ 图片处理:FastDFS ​ 定时任务:xxl-job 2.前端: ​ Vue、Element-UI ## 功能 系统五个功能模块为:试题管理模块、系统监控模块、模拟考试模块、系统管理模块、个人信息模块。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%871.png) ## 登录 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%872.png) ### **模拟考试模块** **小车(c1,c2)、货车(b2)、客车(a1)** **包含科目一 科目四试题** 1.顺序练习 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%879.png) 2.随机练习 3.专项练习:按照单选题和判断题划分。 4.模拟考试:随机100道题,计时45分钟。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%8710.png) ### **试题管理模块** 1.试题字典:按照指定条件搜索,添加、修改、删除试题(管理员权限)。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%874.png) 添加/修改试题: ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%8712.png) 2.推荐试题:按照后台针对用户错题进行计算返回的一定数目的试题。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%873.png) ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%875.png) 3.我的错题:每次用户计算错题后进行记录。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%876.png) 4.我的收藏:用户收藏的试题。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%877.png)

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值