docs(Circle): use composition api

This commit is contained in:
chenjiahan
2020-12-13 12:42:42 +08:00
parent e4eb2d07d7
commit 42916dd50f
3 changed files with 87 additions and 64 deletions
+19 -13
View File
@@ -24,17 +24,18 @@ app.use(Circle);
```
```js
import { ref, computed } from 'vue';
export default {
data() {
setup() {
const currentRate = ref(0);
const text = computed(() => currentRate.value.toFixed(0) + '%');
return {
currentRate: 0,
text,
currentRate,
};
},
computed: {
text() {
return this.currentRate.toFixed(0) + '%';
},
},
};
```
@@ -72,14 +73,19 @@ export default {
```
```js
import { ref } from 'vue';
export default {
data() {
setup() {
const currentRate = ref(0);
const gradientColor = {
'0%': '#3fecff',
'100%': '#6149f6',
};
return {
currentRate: 0,
gradientColor: {
'0%': '#3fecff',
'100%': '#6149f6',
},
currentRate,
gradientColor,
};
},
};