naive-ui/demo/documentation/components/progress/enUS/multipleCircle.md
2020-02-01 00:47:07 +08:00

1.5 KiB

Multiple Circle

Maybe your PM will need this.

You can show multiple circle in a single progress. Note that circle-gap and stroke-width is relative to 100(the svg's viewbox size is 100).

<n-config-consumer>
  <template v-slot="{ styleScheme }">
    <n-progress
      type="multiple-circle"
      :stroke-width="6"
      :circle-gap="0.5"
      :percentage="[
        percentage,
        (percentage + 10) % 100,
        (percentage + 20) % 100,
        (percentage + 30) % 100]"
      :color="[
        styleScheme.infoColor,
        styleScheme.successColor,
        styleScheme.warningColor,
        styleScheme.errorColor
      ]"
      :rail-color="[
        styleScheme.infoColor + '30',
        styleScheme.successColor + '30',
        styleScheme.warningColor + '30',
        styleScheme.errorColor + '30'
      ]"
    >
      <div style="text-align: center;">
        What is this?
      </div>
    </n-progress>
  </template>
</n-config-consumer>
<div>
  <n-button @click="minus">
    Minus 10%
  </n-button>
  <n-button @click="add">
    Add 10%
  </n-button>
</div>
export default {
  data () {
    return {
      percentage: 0
    }
  },
  methods: {
    add () {
      this.percentage += 10
      if (this.percentage > 100) this.percentage = 0
    },
    minus () {
      this.percentage -= 10
      if (this.percentage < 0) this.percentage = 100
    }
  }
}
.n-progress {
  margin: 0 8px 12px 0;
}
.n-button {
  margin: 0 8px 12px 0;
}