小编Nic*_*ick的帖子

无法加载 next.config.js

克隆我创建的存储库并设置.env.local文件后,运行npm i然后运行npm run dev。服务器启动,加载 env,.env.local但它立即失败,提示我以下内容:

error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
Error: Not supported
    at Object.loadConfig [as default] (C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\server\config.js:399:74)
    at async NextServer.loadConfig (C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\server\next.js:110:22)
    at async NextServer.prepare (C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\server\next.js:92:24)
    at async C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\cli\next-dev.js:126:9
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rebuild@0.1.0 dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rebuild@0.1.0 dev script.
npm ERR! This is probably not …
Run Code Online (Sandbox Code Playgroud)

reactjs next.js

24
推荐指数
3
解决办法
5万
查看次数

从父组件提交表单

我想创建一个表单,其中提交按钮位于标题中。我目前正在使用react-hook-forms,但无法从显示表单(或子项)的布局中的组件提交表单。我添加了一张图像,可以帮助您直观地了解我正在谈论的内容。

在此输入图像描述

有没有办法可以将表单数据或handleSubmit从react-hook-form传递到标头,然后在单击时运行onSubmit?

reactjs react-hook-form

10
推荐指数
3
解决办法
1万
查看次数

使用 Chart.js 绘制半圆环图

有没有办法为chart.js 甜甜圈图实现动画指标?我想要完成的事情是这样的:

最终结果

我已经完成了图表的甜甜圈部分,但似乎无法找到添加值(大文本:89%(动态))或指标点的方法。

我使用的代码如下:

HTML

<canvas id="dashboardChart" width="400" height="400"></canvas>
Run Code Online (Sandbox Code Playgroud)

JS

var ctx = document.getElementById("dashboardChart");
    var dashboardChart = new Chart(ctx, {
        type: 'doughnut',
        data: {
            labels: ["Red", "Orange", "Green"],
            datasets: [{
                label: '# of Votes',
                data: [33, 33, 33],
                backgroundColor: [
                    'rgba(231, 76, 60, 1)',
                    'rgba(255, 164, 46, 1)',
                    'rgba(46, 204, 113, 1)'
                ],
                borderColor: [
                    'rgba(255, 255, 255 ,1)',
                    'rgba(255, 255, 255 ,1)',
                    'rgba(255, 255, 255 ,1)'
                ],
                borderWidth: 5
            }]

        },
        options: {
            rotation: 1 * Math.PI,
            circumference: 1 …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

9
推荐指数
2
解决办法
1万
查看次数

标签 统计

reactjs ×2

css ×1

html ×1

javascript ×1

jquery ×1

next.js ×1

react-hook-form ×1