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

在哪里做网站网站头页

在哪里做网站,网站头页,教育类网站源码,企业免费招聘网站概述 v-if指令主要用来实现条件渲染#xff0c;在实际项目中使用得也非常多。 v-if通常会配合v-else-if、v-else指令一起使用#xff0c;可以达到多个条件执行一个#xff0c;两个条件执行一个#xff0c;满足一个条件执行等多种场景。 下面#xff0c;我们分别演示这三…概述 v-if指令主要用来实现条件渲染在实际项目中使用得也非常多。 v-if通常会配合v-else-if、v-else指令一起使用可以达到多个条件执行一个两个条件执行一个满足一个条件执行等多种场景。 下面我们分别演示这三种使用场景。 基本用法 我们创建src/components/Demo12.vue在这个组件中我们要 场景1v-if单独使用如果count大于0则显示“数字大于0了”。场景2v-if和v-else配合使用如果count大于20则显示“数字大于20了”否则显示“数字小于或者等于20”场景3v-if、v-else-if、v-else配合使用如果count大于100则显示“数字大于100了”如果count等于100则显示“数字等于100了”否则显示“数字小于100了” 为了便于查看效果我们还要通过两个按钮一个按钮控制count的增加另一个按钮控制count的减少。 代码如下 script setup import {ref} from vue;const count ref(33) /script templatediv v-ifcount0数字大于0了/divhrdiv v-ifcount20数字大于20了/divdiv v-else数字小于或者等于20/divhrdiv v-ifcount100数字大于100了/divdiv v-else-ifcount100数字等于100了/divdiv v-else数字小于100了/divhrdivh3{{ count }}/h3button clickcount10增加/buttonbutton clickcount-10减少/button/div /template接着我们修改src/App.vue引入Demo12.vue并进行渲染 script setup import Demo from ./components/Demo12.vue /script templateh1欢迎跟着Python私教一起学习Vue3入门课程/h1hrDemo/ /template然后我们浏览器访问http://localhost:5173/ 完整代码 package.json {name: hello,private: true,version: 0.1.0,type: module,scripts: {dev: vite,build: vite build},dependencies: {vue: ^3.3.8},devDependencies: {vitejs/plugin-vue: ^4.5.0,vite: ^5.0.0} }vite.config.js import { defineConfig } from vite import vue from vitejs/plugin-vueexport default defineConfig({plugins: [vue()], })index.html !doctype html html langenheadmeta charsetUTF-8 /link relicon typeimage/svgxml href/vite.svg /meta nameviewport contentwidthdevice-width, initial-scale1.0 /titleVite Vue/title/headbodydiv idapp/divscript typemodule src/src/main.js/script/body /htmlsrc/main.js import { createApp } from vue import App from ./App.vuecreateApp(App).mount(#app)src/App.vue script setup import Demo from ./components/Demo12.vue /script templateh1欢迎跟着Python私教一起学习Vue3入门课程/h1hrDemo/ /templatesrc/components/Demo12.vue script setup import {ref} from vue;const count ref(33) /script templatediv v-ifcount0数字大于0了/divhrdiv v-ifcount20数字大于20了/divdiv v-else数字小于或者等于20/divhrdiv v-ifcount100数字大于100了/divdiv v-else-ifcount100数字等于100了/divdiv v-else数字小于100了/divhrdivh3{{ count }}/h3button clickcount10增加/buttonbutton clickcount-10减少/button/div /template启动方式 yarn yarn dev浏览器访问http://localhost:5173/
http://www.yutouwan.com/news/36856/

相关文章:

  • 中国交通建设监理协会网站如何做织梦论坛类的网站
  • 电子商务网站建设前期规划方案建设网站的企业公司
  • 网页设计公司网站设计公司注册资金多少的利弊
  • 网站添加flv视频代码专业做鞋子网站有哪些
  • 自己做门户网站简单的招聘网站怎么做
  • 免费网站服务器租用wordpress后台变慢
  • 做神马网站优化排名wordpress 插件 code
  • 企业网站wordpress如何做网站的书籍
  • 中国站长站官网政务网站开发合同
  • 免费php网站模板下载重庆网站建设制作设计公司
  • 做网站的的报价做seo网站标题重要吗
  • 红色系列的网站前端自己写代码建网站要花多少钱
  • 厦门网站制作开发收费网站建设案例平台
  • 河南省专业做网站公司如何在百度做网站推广
  • 深圳网站外包邢台手机网站制作
  • 个性化网站建设公司企业网站建设制作
  • 网站开发工程师心得总结网站空间的管理
  • app手机端电子商务网站功能静安网站建设公司
  • 活动策划公司网站高端美食网站建设
  • 网站建设调研问卷wordpress图片数据库
  • 建设企业网站e路护航官网下载wordpress图片乱码
  • 网址跳转网站襄阳百度开户
  • 网站制作公司 首推万维科技网站平均停留时间
  • 六安公司做网站试描述一下网站建设的基本流程图
  • 农产品网络营销模式福州百度快速优化
  • 陕西网站推广公司分销渠道管理
  • 成品源码网站asp.net新建网站
  • 跨境外贸网抖音seo优化怎么做
  • 如何做网站页面赚钱网站关键词 查询
  • 什么语言建手机网站培训网站