In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces Vue how to control the quantity of goods components, the article introduces in great detail, has a certain reference value, interested friends must read it!
To achieve the effect
Control the quantity of goods package Numbox
-+ import {useVModel} from'@ vueuse/core'export default {name: 'XtxNumbox', props: {modelValue: {type: Number, default: 1}, inventory: {type: Number, required: true}}, setup (props, {emit}) {/ / bidirectional binding of data based on third-party methods const num = useVModel (props 'modelValue', emit) / / controls the change operation of commodity data const toggle = (n) = > {if (n)
< 0) { // 减一操作 if (num.value >1) {num.value-= 1}} else {/ / add one operation if (num.value
< 10) { num.value += 1 } } } return { num, toggle } }}.xtx-numbox { display: flex; align-items: center; .label { width: 60px; color: #999; padding-left: 10px; } .numbox { width: 120px; height: 30px; border: 1px solid #e4e4e4; display: flex; >A {width: 29px; line-height: 28px; text-align: center; background: # f8f8f8; font-size: 16px; color: # 666; &: first-of-type {border-right: 1px solid # e4e4e4;} &: last-of-type {border-left: 1px solid # e4e4e4;}} > input {width: 60px Padding: 0 5px; text-align: center; color: # 666;}
Used in the parent component
Quantity setup () {/ / quantity of goods / / default value is 1 const num=ref (1) return {num}} above is all the contents of the article "how to control the quantity components of goods by Vue". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.