|
1 year ago | |
---|---|---|
.. | ||
components | 1 year ago | |
hybrid | 1 year ago | |
changelog.md | 1 year ago | |
package.json | 1 year ago | |
readme.md | 1 year ago |
<l-circle v-model:current="modelVale" :percent="target">
<text>{{modelVale}}%</text>
</l-circle>
const target = ref(50)
const modelVale = ref(0)
也可以主动设置 canvas
使用canvas方式渲染
<l-circle v-model:current="modelVale" :percent="target" canvas>
<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 | 进度条顶端形态 , 可选值 butt 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 |
canvas | 是否使用canvas渲染 | boolean | false |