react实现加减数量控件效果代码

代码语言:html

所属分类:其他

代码描述:react实现加减数量控件效果代码

代码标签: react 加减 数量 控件

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet" />
  
  
  
<style>
* {
  box-sizing: border-box;
}

body {
  background-color: #2c2c2c;
  font-family: "Roboto", sans-serif;
  line-height: 1.5;
  margin: 0;
}

button {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.app {
  display: grid;
  min-block-size: 100vh;
  padding: 5vmin;
  place-items: center;
}

.counter {
  background-color: #282828;
  border-radius: 999em;
  display: flex;
  font-size: 1.25rem;
  gap: 0.25em;
  justify-content: space-between;
  padding: 0.5em 1em;
}

.counter__button {
  color: #7a7a7a;
  font-family: monospace;
  padding: 0.5em 1em;
}

.counter__output {
  aspect-ratio: 1 / 1;
  background-color: #3b3b3b;
  border-radius: 50%;
  box-shadow: 0 0.125em 0.125em rgb(0 0 0 / 50%);
  color: #fff;
  display: flex;
  font-size: 2em;
  min-height: 100%;
  padding: 0.5em;
  place-items: center;
}
</style>


  
  
</head>

<body >
  <div id="root"></div>

      <script  type="module">
import clamp from "https://cdn.skypack.dev/lodash@4/clamp";
import isUndefined from "https://cdn.skypack.dev/lodash@4/isUndefined";
import React, {
useEffect,
useState,
StrictMode } from
"https://cdn.skypack.dev/react@17.0.1";
import { render } from "https://cdn.skypack.dev/react-dom@17.0.1";

fu.........完整代码请登录后点击上方下载按钮下载查看

网友评论0