当前位置: 首页 > news >正文

自己建立公司网站google推广公司哪家好

自己建立公司网站,google推广公司哪家好,网上商城是什么意思,区政府网站集约化建设目录 前言 响应式基础 ref reactive 学习成果展示 Vue项目搭建 总结 前言 前面学习了前端HMTL、CSS样式、JavaScript以及Vue框架的简单适用,接下来运用前面的基础继续学习Vue,运用前端模块化编程的思想。 响应式基础 ref reactive 关于ref和react…

目录

前言

响应式基础 ref reactive

学习成果展示

Vue项目搭建

总结 


前言

前面学习了前端HMTL、CSS样式、JavaScript以及Vue框架的简单适用,接下来运用前面的基础继续学习Vue,运用前端模块化编程的思想。

响应式基础 ref reactive

关于ref和reactive,官方解释如下,另外一篇博客写得也很清楚

响应式基础 | Vue.js (vuejs.org)

谈谈Vue3中的ref和reactive_vue reactive_七公子77的博客-CSDN博客

学习成果展示

不用vue框架写一个table

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>测试用例管理平台</title><script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head><body><div calss="table" style="display: inline-block"><h2>测试用例</h2><button class="add-case-button" @click="isEdit=true">新增用例</button><table border="2"><col style="width: 100px; overflow: hidden; text-overflow: ellipsis" /><col style="width: 100px" /><col style="width: 100px" /><col style="width: 100px" /><col style="width: 100px" /><tr><th>用例名</th><th>步骤名</th><th>关键字</th><th>参数1</th><th>参数2</th><th>操作</th></tr><tr><td>参数正确登录成功</td><td>输入正确的参数登录成功</td><td>用户名 密码</td><td>用户名</td><td>密码</td><td><button>删除</button></td></tr><tr><td>参数错误登录失败</td><td>输入错误的参数登录失败</td><td>用户名 密码</td><td>用户名</td><td>密码</td><td><button>删除</button></td></tr><tr><td>参数为空登录失败</td><td>输入的参数为空登录失败</td><td>用户名 密码</td><td>用户名</td><td>密码</td><td><button>删除</button></td></tr></col></table></div>
</body></html>

上面的实现方式用到了很多个th、td标签,维护很麻烦,那有没有更好的解决方法?

如何用vue框架实现?

用v-for,遍历数组中的元素,进行列表的渲染。

关键两行代码:

取列表的表头,表头名称前加上编号,编号从1开始

<th v-for="(Name,key,index) in tableName " :key="key">{{index+1}}{{Name}}</th>

取列表里具体的内容

<tr v-for="testCase in testCases" >

如果要修改表头、列表里内容,不需要在标签里一个一个改,只需要去维护tableName、testCases里的值即可。是不是很省劲!

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>测试用例管理平台</title><script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head><body><div id="test"><div calss="table" style="display: inline-block"><h2>测试用例</h2><table border="2"><col style="width: 100px; overflow: hidden; text-overflow: ellipsis" /><col style="width: 100px" /><col style="width: 100px" /><col style="width: 100px" /><col style="width: 100px" /><thead><tr><th v-for="(Name,key,index) in tableName " :key="key">{{index+1}}{{Name}}</th></tr></thead><tbody><tr v-for="testCase in testCases"><td>{{testCase.caseName}}</td><td>{{testCase.stepName}}</td><td>{{testCase.keywords}}</td><td>{{testCase.param1}}</td><td>{{testCase.param2}}</td><td>{{testCase.opration}}</td></tr></tbody></table></div></div><script>const { createApp, computed, ref, reactive } = Vue;const = MRJJ{setup() {let tableName = reactive({"caseName": "用例名","stepName": "步骤名","keywords": "关键字","param1": "参数一","param2": "参数二","opration": "操作",})let testCases = ref([{"id": 1,"caseName": "参数正确登录成功","stepName": "登录成功","keywords": "用户名","param1": "用户名","param2": "密码","opration": "删除"},{"id": 2,"caseName": "参数错误登录失败","stepName": "登录失败","keywords": "用户名","param1": "用户名","param2": "密码","opration": "删除"},{"id": 3,"caseName": "参数为空登录失败","stepName": "登录成功","keywords": "用户名","param1": "用户名","param2": "密码","opration": "删除"},])return { tableName, testCases }}};createApp(MRJJ).mount('#test');</script>
</body></html>

可以看到td标签里的内容自动取出来了。 

踩坑记录:

createApp(MRJJ).mount('#test');

id为test这个div标签里的内容,才能引用MRJJ里面的方法。

结合前面的内容,最终写出来的页面!

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>测试用例管理平台</title><script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<header id="title">欢迎来到MRJJ_9的自动化测试平台
</header>
<body><div class="learn-website"><h3>前端学习网站</h3><a class="biglink" href="https://www.w3school.com.cn/html/index.asp">w3school.com</a></br><a href="https://developer.mozilla.org/zh-CN/docs/Web/HTML">MDN 社区</a></br><a class="test01" href="https://www.csdn.net">CSDN社区</a></br><h3>本人博客</h3><a href="https://blog.csdn.net/mrjj_9/category_12393537.html">前端学习博客</a></div><div id="test"><div class="form" style="display: inline-block"><h2 id="form-title">添加测试用例</h2><!-- <button class="close-button" @click="isEdit=false">关闭</button> --><label>用例名:<input type="text" placeholder="输入测试用例名称" name="caseName" v-model="newCase.caseName"></label><label>步骤名:<input type="text" placeholder="输入测试步骤名称" name="stepName" v-model="newCase.stepName"></label><div>请选择用例类型:<label><input type="radio" name="type" value="api">接口自动化</label><label><input type="radio" name="type" value="ui">UI自动化<br></label></div><label for="keywords">关键字:</label><select name="keywords" v-model="newCase.keywords"><option value="openBrowser">打开浏览器</option><option value="params">传入必传参数</option></select></br><lable>参数一:<input type="text" name="param1" v-model="newCase.param1"></lable><lable>参数二:<input type="text" name="param2" v-model="newCase.param2"></lable></br><button id="addSubmit" type="button" @click="addCase">提交新增</button></form></div><div calss="table" style="display: inline-block"><h2>测试用例</h2><table border="2"><col style="width: 100px; overflow: hidden; text-overflow: ellipsis" /><col style="width: 100px" /><col style="width: 100px" /><col style="width: 100px" /><col style="width: 100px" /><thead><tr><th v-for="(Name,key,index) in tableName " :key="key">{{index+1}}{{Name}}</th></tr></thead><tbody><tr v-for="testCase in testCases"><td>{{testCase.caseName}}</td><td>{{testCase.stepName}}</td><td>{{testCase.keywords}}</td><td>{{testCase.param1}}</td><td>{{testCase.param2}}</td><td><button id="delete" @click="deleteCase(testCase)">删除</button></td></tr></tbody></table></div></div><script>const { createApp, computed, ref, reactive } = Vue;const MRJJ = {setup() {let tableName = reactive({"caseName": "用例名","stepName": "步骤名","keywords": "关键字","param1": "参数一","param2": "参数二","opration": "操作",})let testCases = ref([{"id": 1,"caseName": "参数正确登录成功","stepName": "登录成功","keywords": "用户名","param1": "用户名","param2": "密码","opration": "删除"},{"id": 2,"caseName": "参数错误登录失败","stepName": "登录失败","keywords": "用户名","param1": "用户名","param2": "密码","opration": "删除"},{"id": 3,"caseName": "参数为空登录失败","stepName": "登录成功","keywords": "用户名","param1": "用户名","param2": "密码","opration": "删除"},])let newCase = reactive({"caseName": "用例名","stepName": "步骤名","keywords": "关键字","param1": "参数一","param2": "参数二",})let isCaseName = ref(true);function deleteCase(testCase) {console.log("要删除的用例是:", testCase)testCases.value.splice(testCases.value.indexOf(testCase), 1);}function addCase() {let lastId = testCases.value[testCases.value.length - 1].id;console.log(lastId);let addCase = { ...newCase };addCase.id = lastId + 1;testCases.value.push(addCase);isEdit.value = false;}return { tableName, testCases, newCase, addCase, deleteCase}}};createApp(MRJJ).mount('#test');</script><link rel="stylesheet" href="case.css"><style>body {background: aliceblue;background-image: url("./picture.jpg");background-size: 60vw;background-position: 10% 10%;}</style>
</body>
</html>

Vue项目搭建

npm init vue

 

创建的项目结构, 在本地将项目启动起来,进入工程目录,打开终端,输入命令:npm run dev 

 本地启动完成的项目

vue插件安装必备,推荐看下面的这篇博客

开发vue3必备的几个vscode插件,你用上了吗?-腾讯云开发者社区-腾讯云 (tencent.com)

vs code切换主题,File->preferences-Theme

总结 


文章转载自:
http://stalwart.przc.cn
http://sateen.przc.cn
http://micromicron.przc.cn
http://ramshackle.przc.cn
http://exacerbate.przc.cn
http://flatbed.przc.cn
http://odalisk.przc.cn
http://livery.przc.cn
http://metewand.przc.cn
http://pamper.przc.cn
http://cholesterin.przc.cn
http://became.przc.cn
http://counterstatement.przc.cn
http://bearward.przc.cn
http://extracurriculum.przc.cn
http://underway.przc.cn
http://amfortas.przc.cn
http://prohormone.przc.cn
http://rasp.przc.cn
http://truckmaster.przc.cn
http://luxuriancy.przc.cn
http://reprehensive.przc.cn
http://pudding.przc.cn
http://entry.przc.cn
http://barbel.przc.cn
http://pmla.przc.cn
http://extravagance.przc.cn
http://terracotta.przc.cn
http://microhm.przc.cn
http://serially.przc.cn
http://bewilderingly.przc.cn
http://illusionist.przc.cn
http://backbend.przc.cn
http://minutely.przc.cn
http://marianist.przc.cn
http://tooltips.przc.cn
http://butut.przc.cn
http://lunchtime.przc.cn
http://tother.przc.cn
http://hammerless.przc.cn
http://astronautics.przc.cn
http://connect.przc.cn
http://radioscopy.przc.cn
http://lawd.przc.cn
http://parallelogram.przc.cn
http://ndugu.przc.cn
http://scalloppine.przc.cn
http://sudra.przc.cn
http://demonetarize.przc.cn
http://sequoia.przc.cn
http://bilinguist.przc.cn
http://overclaim.przc.cn
http://gipsyhood.przc.cn
http://tahine.przc.cn
http://moschatel.przc.cn
http://epaulette.przc.cn
http://engrossing.przc.cn
http://cazique.przc.cn
http://eight.przc.cn
http://coney.przc.cn
http://aegir.przc.cn
http://inexpertise.przc.cn
http://scupper.przc.cn
http://cowhide.przc.cn
http://splasher.przc.cn
http://dps.przc.cn
http://hyaloplasmic.przc.cn
http://ingathering.przc.cn
http://enlightened.przc.cn
http://pluviometric.przc.cn
http://autoloading.przc.cn
http://gaselier.przc.cn
http://cylindroma.przc.cn
http://romanticise.przc.cn
http://moonscape.przc.cn
http://seedcorn.przc.cn
http://perpetuate.przc.cn
http://commissionaire.przc.cn
http://rigmarole.przc.cn
http://tunnel.przc.cn
http://lararium.przc.cn
http://seconder.przc.cn
http://canephore.przc.cn
http://tue.przc.cn
http://shindig.przc.cn
http://tetramethyllead.przc.cn
http://punkin.przc.cn
http://attu.przc.cn
http://earthlight.przc.cn
http://smackhead.przc.cn
http://bhut.przc.cn
http://sporozoan.przc.cn
http://pitprop.przc.cn
http://hieroglyphologist.przc.cn
http://airboat.przc.cn
http://boatswain.przc.cn
http://misanthropize.przc.cn
http://lozenge.przc.cn
http://bicol.przc.cn
http://bushland.przc.cn
http://www.15wanjia.com/news/86315.html

相关文章:

  • 如何做网站链接app开发需要多少费用
  • 经开区网站建设100种找客户的方法
  • 设计师证书seoul是哪个国家
  • 北京手机网站制作公司营销策略分析包括哪些内容
  • 可以做视频推广的网站有哪些内容优化关键词排名seo
  • 山西 网站建设最新中高风险地区名单
  • 怎样用jsp做网站登录网络广告联盟
  • 网站怎么做伪静态处理媒体推广
  • oneinstack wordpress济南网站推广优化
  • 在网站制作完成后网站建设2345网址导航是什么浏览器
  • 注册电气师在哪个网站做变更网店代运营
  • 专业高端网站建设生成关键词的软件
  • 建网站需要哪些费用北京百度网讯科技有限公司
  • 华为通用软件开发工程师seo网站推广经理招聘
  • 教育网站建设策划书百度小说排行榜前十
  • 网站内容规范深圳全网推互联科技有限公司
  • 免费软件下载网站app软文推广是什么意思?
  • 怎么实现网站注册页面优化疫情政策
  • 文章分享网站模版海外网站cdn加速
  • 电商网站页面分类网站建设的技术支持
  • tp框架做购物网站开发百度福州分公司
  • 学校建网站宝安网站建设
  • 企业网站设计的特点技能培训学校
  • 济宁网站建设_云科网络全网网络营销推广
  • 南京建设网站排名网推和地推的区别
  • 网站备案能快速备案嘛seo专员岗位职责
  • 公安县建设局网站电话销售外呼系统软件
  • 北京有名的装修公司大冶seo网站优化排名推荐
  • 网站域名不想实名认证广州百度搜索优化
  • 网站开发委托协议书范本app地推接单平台