/*! For license information please see 793.c19a6a88.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["793"],{92877:function(s,n,a){"use strict";a.r(n);var t=a("80681");let e=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'

Circle \u73AF\u5F62\u8FDB\u5EA6\u6761

\n

\u4ECB\u7ECD

\n

\u5706\u73AF\u5F62\u7684\u8FDB\u5EA6\u6761\u7EC4\u4EF6\uFF0C\u652F\u6301\u8FDB\u5EA6\u6E10\u53D8\u52A8\u753B\u3002

\n

\u5F15\u5165

\n

\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5168\u5C40\u6CE8\u518C\u7EC4\u4EF6\uFF0C\u66F4\u591A\u6CE8\u518C\u65B9\u5F0F\u8BF7\u53C2\u8003\u7EC4\u4EF6\u6CE8\u518C\u3002

\n
import { createApp } from 'vue';\nimport { Circle } from 'vant';\n\nconst app = createApp();\napp.use(Circle);\n
\n

\u4EE3\u7801\u6F14\u793A

\n

\u57FA\u7840\u7528\u6CD5

\n

rate \u5C5E\u6027\u8868\u793A\u8FDB\u5EA6\u6761\u7684\u76EE\u6807\u8FDB\u5EA6\uFF0Cv-model:current-rate \u8868\u793A\u52A8\u753B\u8FC7\u7A0B\u4E2D\u7684\u5B9E\u65F6\u8FDB\u5EA6\u3002\u5F53 rate \u53D1\u751F\u53D8\u5316\u65F6\uFF0Cv-model:current-rate \u4F1A\u4EE5 speed \u7684\u901F\u5EA6\u53D8\u5316\uFF0C\u76F4\u81F3\u8FBE\u5230 rate \u8BBE\u5B9A\u7684\u503C\u3002

\n
<van-circle\n  v-model:current-rate="currentRate"\n  :rate="30"\n  :speed="100"\n  :text="text"\n/>\n
\n
import { ref, computed } from 'vue';\n\nexport default {\n  setup() {\n    const currentRate = ref(0);\n    const text = computed(() => currentRate.value.toFixed(0) + '%');\n\n    return {\n      text,\n      currentRate,\n    };\n  },\n};\n
\n

\u5BBD\u5EA6\u5B9A\u5236

\n

\u901A\u8FC7 stroke-width \u5C5E\u6027\u6765\u63A7\u5236\u8FDB\u5EA6\u6761\u5BBD\u5EA6\uFF0Cstroke-width \u6307\u7684\u662F SVG \u4E2D path \u7684\u5BBD\u5EA6\uFF0C\u9ED8\u8BA4\u503C\u4E3A 40\u3002

\n
<van-circle\n  v-model:current-rate="currentRate"\n  :rate="rate"\n  :stroke-width="60"\n  text="\u5BBD\u5EA6\u5B9A\u5236"\n/>\n
\n

stroke-width \u7684\u5355\u4F4D\u4E0D\u662F px\uFF0C\u5982\u679C\u4F60\u60F3\u77E5\u9053 stroke-width \u4E0E px \u7684\u6362\u7B97\u5173\u7CFB\uFF0C\u53EF\u4EE5\u901A\u8FC7\u5982\u4E0B\u516C\u5F0F\u8BA1\u7B97\uFF1A

\n
// SVG \u7684 viewBox \u5927\u5C0F\nconst viewBox = 1000 + strokeWidth;\n\n// Circle \u7EC4\u4EF6\u7684\u5BBD\u5EA6\uFF0C\u9ED8\u8BA4\u4E3A 100px\nconst circleWidth = 100;\n\n// \u6700\u7EC8\u6E32\u67D3\u51FA\u6765\u7684\u8FDB\u5EA6\u6761\u5BBD\u5EA6\uFF08px\uFF09\nconst pxWidth = (strokeWidth * circleWidth) / viewBox;\n
\n

\u989C\u8272\u5B9A\u5236

\n

\u901A\u8FC7 color \u5C5E\u6027\u6765\u63A7\u5236\u8FDB\u5EA6\u6761\u989C\u8272\uFF0Clayer-color \u5C5E\u6027\u6765\u63A7\u5236\u8F68\u9053\u989C\u8272\u3002

\n
<van-circle\n  v-model:current-rate="currentRate"\n  :rate="rate"\n  layer-color="#ebedf0"\n  text="\u989C\u8272\u5B9A\u5236"\n/>\n
\n

\u6E10\u53D8\u8272

\n

color \u5C5E\u6027\u652F\u6301\u4F20\u5165\u5BF9\u8C61\u683C\u5F0F\u6765\u5B9A\u4E49\u6E10\u53D8\u8272\u3002

\n
<van-circle\n  v-model:current-rate="currentRate"\n  :rate="rate"\n  :color="gradientColor"\n  text="\u6E10\u53D8\u8272"\n/>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const currentRate = ref(0);\n    const gradientColor = {\n      '0%': '#3fecff',\n      '100%': '#6149f6',\n    };\n\n    return {\n      currentRate,\n      gradientColor,\n    };\n  },\n};\n
\n

\u9006\u65F6\u9488\u65B9\u5411

\n

\u5C06 clockwise \u8BBE\u7F6E\u4E3A false\uFF0C\u8FDB\u5EA6\u4F1A\u4ECE\u9006\u65F6\u9488\u65B9\u5411\u5F00\u59CB\u3002

\n
<van-circle\n  v-model:current-rate="currentRate"\n  :rate="rate"\n  :clockwise="false"\n  text="\u9006\u65F6\u9488\u65B9\u5411"\n/>\n
\n

\u5927\u5C0F\u5B9A\u5236

\n

\u901A\u8FC7 size \u5C5E\u6027\u8BBE\u7F6E\u5706\u73AF\u76F4\u5F84\u3002

\n
<van-circle\n  v-model:current-rate="currentRate"\n  :rate="rate"\n  size="120px"\n  text="\u5927\u5C0F\u5B9A\u5236"\n/>\n
\n

\u8D77\u59CB\u4F4D\u7F6E

\n

\u8FDB\u5EA6\u6761\u9ED8\u8BA4\u4ECE\u9876\u90E8\u5F00\u59CB\uFF0C\u53EF\u4EE5\u901A\u8FC7 start-position \u5C5E\u6027\u8BBE\u7F6E\u8D77\u59CB\u4F4D\u7F6E\u3002

\n
<van-circle\n  v-model:current-rate="currentRate"\n  :rate="rate"\n  text="\u5DE6\u4FA7"\n  start-position="left"\n/>\n<van-circle\n  v-model:current-rate="currentRate"\n  :rate="rate"\n  text="\u53F3\u4FA7"\n  start-position="right"\n/>\n<van-circle\n  v-model:current-rate="currentRate"\n  :rate="rate"\n  text="\u5E95\u90E8"\n  start-position="bottom"\n/>\n
\n

API

\n

Props

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B\u9ED8\u8BA4\u503C
v-model:current-rate\u5F53\u524D\u8FDB\u5EA6number-
rate\u76EE\u6807\u8FDB\u5EA6number | string100
size\u5706\u73AF\u76F4\u5F84\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3A pxnumber | string100px
color\u8FDB\u5EA6\u6761\u989C\u8272\uFF0C\u4F20\u5165\u5BF9\u8C61\u683C\u5F0F\u53EF\u4EE5\u5B9A\u4E49\u6E10\u53D8\u8272string | object#1989fa
layer-color\u8F68\u9053\u989C\u8272stringwhite
fill\u586B\u5145\u989C\u8272stringnone
speed\u52A8\u753B\u901F\u5EA6\uFF08\u5355\u4F4D\u4E3A rate/s\uFF09number | string0
text\u6587\u5B57string-
stroke-width\u8FDB\u5EA6\u6761\u5BBD\u5EA6number | string40
stroke-linecap\u8FDB\u5EA6\u6761\u7AEF\u70B9\u7684\u5F62\u72B6\uFF0C\u53EF\u9009\u503C\u4E3A square buttstringround
clockwise\u662F\u5426\u987A\u65F6\u9488\u589E\u52A0booleantrue
start-position\u8FDB\u5EA6\u8D77\u59CB\u4F4D\u7F6E\uFF0C\u53EF\u9009\u503C\u4E3A left\u3001right\u3001bottomCircleStartPositiontop
\n

Slots

\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u540D\u79F0\u8BF4\u660E
default\u81EA\u5B9A\u4E49\u6587\u5B57\u5185\u5BB9
\n

\u7C7B\u578B\u5B9A\u4E49

\n

\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A

\n
import type { CircleProps, CircleStartPosition } from 'vant';\n
\n

\u4E3B\u9898\u5B9A\u5236

\n

\u6837\u5F0F\u53D8\u91CF

\n

\u7EC4\u4EF6\u63D0\u4F9B\u4E86\u4E0B\u5217 CSS \u53D8\u91CF\uFF0C\u53EF\u7528\u4E8E\u81EA\u5B9A\u4E49\u6837\u5F0F\uFF0C\u4F7F\u7528\u65B9\u6CD5\u8BF7\u53C2\u8003 ConfigProvider \u7EC4\u4EF6\u3002

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u540D\u79F0\u9ED8\u8BA4\u503C\u63CF\u8FF0
--van-circle-size100px-
--van-circle-colorvar(--van-primary-color)-
--van-circle-layer-colorvar(--van-white)-
--van-circle-text-colorvar(--van-text-color)-
--van-circle-text-font-weightvar(--van-font-bold)-
--van-circle-text-font-sizevar(--van-font-size-md)-
--van-circle-text-line-heightvar(--van-line-height-md)-
\n
'},null,8,e))}}}]);