catch
здесь тоже нужно учесть, т.к. он возвращает Promise<any>
, соответственно тебе нужно использовать примерно такую конструкцию:const getData = async (url: string): Promise<Res | any> => await fetch(url).then((data: Response): Promise<Res> => data.json()).catch(err => err.message);
modal: boolean = false
showmodal() {
this.modal = !this.modal
}
<button (click)="product.showmodal()" class="btn btn-primary">Детальная информация</button>
app-product
показывай или не показывай модалку в зависимости от modal
"fix": "git add . && git commit -m \"fix: %npm_config_name%\" && git status && git tag"
npm run fix --name="text 123"
git init
git remote add <name> <url>
git pull <name>
git checkout <main branch name>
git checkout -b <some name>/git branch <some name>
git status
git add .
git push <remote name> +head
<template>
<div class="doughnut">
<canvas ref="chart"></canvas>
</div>
</template>
<script setup>
import {onMounted, ref} from "vue";
import {
Chart,
DoughnutController,
ArcElement,
} from 'https://cdn.skypack.dev/chart.js@4.2.1';
Chart.register(
DoughnutController,
ArcElement,
);
const chart = ref(null);
const data = {
datasets: [
{
data: [40, 22, 8, 30],
backgroundColor: [
"#F04B92",
"#54B2FD",
"#FFC24B",
"#49EBCE",
],
display: true,
offset: 2,
spacing: -30,
borderColor: "#fff",
borderWidth: 2,
borderRadius: [
{outerStart: 16, outerEnd: 2, innerStart: 16},
{outerStart: 16, outerEnd: 2, innerStart: 16},
{outerStart: 16, outerEnd: 2, innerStart: 16},
{outerStart: 16, outerEnd: 16, innerStart: 16, innerEnd: 16}
],
cutout: "58%",
}
],
labels: false
};
const config = {
type: 'doughnut',
data,
options: {
rotation: 270,
circumference: 180,
maintainAspectRatio: false,
responsive: true,
animation: {
animateRotate: true
}
},
}
onMounted(() => {
const myChart = new Chart(
chart.value,
config
);
const ctx = myChart.canvas.getContext("2d");
ctx.scale(0.8, 0.8);
});
</script>