|
|
2 anni fa | |
|---|---|---|
| .. | ||
| components | 2 anni fa | |
| hybrid | 2 anni fa | |
| changelog.md | 2 anni fa | |
| package.json | 2 anni fa | |
| readme.md | 2 anni fa | |
导入插件后直接使用
<l-circle v-model:current="modelVale" :percent="target">
<text>{{modelVale}}%</text>
</l-circle>
const target = ref(50)
const modelVale = ref(0)
导入后直接使用这个标签查看演示效果,
// 代码位于 uni_modules/lime-circle/compoents/lime-circle
<lime-circle />
composition-api, 如果你希望在vue2中使用请按官方的教程vue-composition-api配置// main.js vue2
import Vue from 'vue'
import VueCompositionAPI from '@vue/composition-api'
Vue.use(VueCompositionAPI)
另外插件也用到了TS,vue2可能会遇过官方的TS版本过低的问题,找到HX目录下的compile-typescript目录
// \HBuilderX\plugins\compile-typescript
yarn add typescript -D
- or -
npm install typescript -D
<l-circle :current.sync="modelVale" :percent="target">
<text>{{modelVale}}%</text>
</l-circle>
<button @tap="onClick(20)">+</button>
<button @tap="onClick(-20)">-</button>
export default {
data() {
return {
modelVale: 0,
target: 50
}
},
methods: {
onClick(number) {
this.target = Math.max(Math.min(100, this.target + number), 0)
}
}
}
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| percent | 进度环目标值 | number | 0 |
| v-model:current | 进度环当前值 | number | - |
| size | 进度环尺寸 | string | 120px |
| lineCap | 进度条顶端形态 , 可选值 - round |
string | round |
| strokeWidth | 进度条宽度 | number | 6 |
| strokeColor | 进度条颜色, 若为数组即为渐变色(渐变色值仅支持hex) | string、string[] | #2db7f5 |
| trailWidth | 轨道环线宽度 | number | 6 |
| trailColor | 轨道环线颜色 | string | #eaeef2 |
| dashboard | 是否为仪表盘样式 | boolean | false |
| clockwise | 是否为顺时针 | boolean | true |
| duration | 变化过渡时间, ms | number | 300 |
| max | 总长度 | number | 100 |