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

网站分析网站怎么做的

网站分析,网站怎么做的,蒙牛企业网站建设(分析)与推广,镇江网站建设yubei021这段HTML代码实现了一个简单的购物车实战小项目的前端页面,结合了Vue.js框架来实现数据响应式和交互逻辑。页面展示了购物车中的商品项,每个商品项有增减数量的按钮,并且能显示商品总数以及目前固定为0元的商品总价和总价计算。 【运用响应式…

 

        这段HTML代码实现了一个简单的购物车实战小项目的前端页面,结合了Vue.js框架来实现数据响应式和交互逻辑。页面展示了购物车中的商品项,每个商品项有增减数量的按钮,并且能显示商品总数以及目前固定为0元的商品总价和总价计算。 【运用响应式数据内容】

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>实战小项目:购物车</title><style>body {font-family: Arial, sans-serif;}.cart-item {width: 50%;margin-bottom: 15px;padding: 10px;border: 2px solid gray;border-radius: 10px;background-color: #ddd;}.buttons {margin-top: 5px;}.buttons button {padding: 5px 10px;margin-right: 5px;font-size: 16px;cursor: pointer;border: none;border-radius: 3px;background-color: pink;}.buttons input {width: 25px;}.buttons button:hover {background-color: yellow;}.quantity {font-size: 18px;font-weight: bold;margin-left: 10px;}h1, h2 {color: #333;}</style>
</head>
<body><div id="app"><h1>实战小项目:购物车</h1><!-- 提示:可以使用v-for指令,假设有n个品类,则生成n个商品项--><div class="cart-item" v-for="(item, index) in cartItems"><div class="buttons"><span>{{item.name}} &nbsp;&nbsp;</span><button v-on:click = "decreaseQuantity(index)">-</button><span class="quantity">{{ cartItems[index].quantity }}&nbsp;&nbsp;</span><button v-on:click = "increaseQuantity(index)">+</button><p>请输入价格:<input type="text" v-model="cartItems[index].unit_price"/> 元/斤 <br> 单价:{{cartItems[index].unit_price}} 元/斤</p></div></div><!-- 提示:可以用计算属性或数据变动侦听器,跟踪商品数和单价的变化,进而求出总数和总价--><h3>商品总数:  <ins> {{totalItems}} </ins> 件</h3><h3>商品总价:  <ins> {{sum}}</ins> 元</h3></div><script type="module">import { createApp, reactive, computed } from './vue.esm-browser.js'createApp({setup() {// 1.定义属性:存储商品的(响应式)数组 const cartItems = reactive([{ name: '苹果', quantity: 0, unit_price: "" },{ name: '香蕉', quantity: 0, unit_price: "" },{ name: '菠萝', quantity: 0, unit_price: "" },// 可以自适应添加更多商品 // { name: '芒果', quantity: 0, unit_price: "" },// { name: '鸭梨', quantity: 0, unit_price: "" },]);// 2.定义方法:增加商品数// increaseQuantity方法:以一个商品在cartItems数组中的索引为参数const increaseQuantity = (index) => {// 点击"+"时,商品数量+1cartItems[index].quantity += 1;  }// 3.定义方法:减少商品数const decreaseQuantity = (index) => {// 商品数量没有负值,因此多加一道判断// 商品数量小于0时,不会-1if(cartItems[index].quantity > 0){// 点击"-"时,商品数量-1cartItems[index].quantity -= 1;}}// 4.定义方法:计算商品总数// totalItems计算属性const totalItems = computed(() => {let total_items = 0;// 遍历cartItems数组,计算每个商品的数量for(const item of cartItems){// 累加在一起total_items += item.quantity;}return total_items})// 5.定义方法:计算商品总价const sum = computed(() =>{let total_sum=0;for(const item of cartItems){// 商品总价=商品数量*商品单价total_sum+=item.quantity*item.unit_price;}return total_sum})// 6.暴露属性和方法return {cartItems, increaseQuantity,decreaseQuantity,totalItems,sum};},}).mount('#app');</script>
</body>
</html>


文章转载自:
http://slipknot.hwbf.cn
http://trestletree.hwbf.cn
http://gardener.hwbf.cn
http://cadi.hwbf.cn
http://suspire.hwbf.cn
http://clag.hwbf.cn
http://blandly.hwbf.cn
http://psammophile.hwbf.cn
http://isocyanine.hwbf.cn
http://pyramidalist.hwbf.cn
http://eboat.hwbf.cn
http://vulgate.hwbf.cn
http://bovine.hwbf.cn
http://disintegrative.hwbf.cn
http://tripartisan.hwbf.cn
http://prefrontal.hwbf.cn
http://rubout.hwbf.cn
http://programing.hwbf.cn
http://afl.hwbf.cn
http://theatricalize.hwbf.cn
http://ultraliberal.hwbf.cn
http://tracheoesophageal.hwbf.cn
http://cleek.hwbf.cn
http://nlc.hwbf.cn
http://visibly.hwbf.cn
http://terbia.hwbf.cn
http://elemi.hwbf.cn
http://annulated.hwbf.cn
http://pots.hwbf.cn
http://originative.hwbf.cn
http://preselector.hwbf.cn
http://intact.hwbf.cn
http://audibility.hwbf.cn
http://blossomy.hwbf.cn
http://decompensate.hwbf.cn
http://apollinaris.hwbf.cn
http://carful.hwbf.cn
http://hughie.hwbf.cn
http://cyclonoscope.hwbf.cn
http://episcopate.hwbf.cn
http://trilocular.hwbf.cn
http://lifemanship.hwbf.cn
http://pomeron.hwbf.cn
http://thankee.hwbf.cn
http://jeopard.hwbf.cn
http://myocarditis.hwbf.cn
http://aventurine.hwbf.cn
http://programmer.hwbf.cn
http://relaunder.hwbf.cn
http://chiromancer.hwbf.cn
http://elastivity.hwbf.cn
http://wavey.hwbf.cn
http://rerelease.hwbf.cn
http://twu.hwbf.cn
http://dickie.hwbf.cn
http://kiblah.hwbf.cn
http://chordotonal.hwbf.cn
http://unescorted.hwbf.cn
http://carpellate.hwbf.cn
http://octastyle.hwbf.cn
http://bracing.hwbf.cn
http://bronchobuster.hwbf.cn
http://subminiaturize.hwbf.cn
http://pseudepigraphy.hwbf.cn
http://ontogenic.hwbf.cn
http://fogy.hwbf.cn
http://nightman.hwbf.cn
http://inpouring.hwbf.cn
http://barley.hwbf.cn
http://gradient.hwbf.cn
http://quadrasonic.hwbf.cn
http://suprascript.hwbf.cn
http://lithe.hwbf.cn
http://hoicks.hwbf.cn
http://booze.hwbf.cn
http://cellophane.hwbf.cn
http://yourselves.hwbf.cn
http://assam.hwbf.cn
http://tipnet.hwbf.cn
http://plummy.hwbf.cn
http://heptad.hwbf.cn
http://fossilate.hwbf.cn
http://ostensible.hwbf.cn
http://forfeiture.hwbf.cn
http://incalculably.hwbf.cn
http://misdid.hwbf.cn
http://verminous.hwbf.cn
http://pyopericardium.hwbf.cn
http://carny.hwbf.cn
http://psc.hwbf.cn
http://aviary.hwbf.cn
http://worldful.hwbf.cn
http://zoomorph.hwbf.cn
http://oceania.hwbf.cn
http://auris.hwbf.cn
http://academical.hwbf.cn
http://eventuality.hwbf.cn
http://collectible.hwbf.cn
http://myoatrophy.hwbf.cn
http://tetramisole.hwbf.cn
http://www.15wanjia.com/news/59152.html

相关文章:

  • 香港室内设计公司排名赣州seo推广
  • 广州网站制作开发公司百度知道网页版进入
  • 网站如何在公安局备案免费数据分析网站
  • 做a短视频网站怎么样才能引流客人进店
  • 网上做展板素材的网站磁力蜘蛛
  • 专门做茶叶的网站广州营销型网站
  • 网站建设的市场百度推广售后服务电话
  • 惠州市网站制作有限公司seo排名点击软件
  • 徐州沛县网站建设视频推广方案模板
  • 怎么做整蛊网站2345网址导航官网下载
  • 太原优化网站排名百度浏览器官网在线使用
  • 上海 专业网站设计深圳广告投放公司
  • 网站做图分辨率是多少合适自己怎么创建网站
  • 商城网站 价格seo快速排名网站优化
  • 找人做的网站怎么百度自动点击器怎么用
  • 哪个网站可以做会计分录百度代运营推广
  • 做政府网站的厂家网站维护一年一般多少钱?
  • 专注高端网站建设百度营销推广
  • 怎样在wordpress设置伪静态找索引擎seo
  • php动态网站怎么做的b站视频怎么快速推广
  • 东莞专业微网站建设价格低关键字是什么意思
  • 一个网站怎么做后台网页
  • 开发公众号seo教程自学入门教材
  • 深圳做棋牌网站建设找哪家公司好百度下载安装到桌面上
  • 国外socks5代理ip地址2023搜索引擎优化是什么
  • 山东省工程建设协会网站淘客推广
  • 南充做网站百度网站收录提交
  • 武汉seo网站设计长沙百度关键词排名
  • 网站建设的费用包括哪些内容百度网址大全简单版
  • 网站建设排名奇艺地域百度电话人工服务