RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-471649

Ahmed_08's questions

Martin Hope
Ahmed_08
Asked: 2025-01-22 21:14:46 +0000 UTC

为什么没有导入来自 global.scss 的 mixin?

  • 4

我有一个反应项目。在 src 中我创建了 global.scss 并尝试将其应用于 app.scss。但是由于某种原因,我可以使用变量,但是当我尝试从那里获取混合时,会出现错误。可能存在什么问题以及如何解决?

这是global.scss:

:root{

    --base-color: blue;

    @mixin flex-position($v, $h){
        display: flex;
        align-items: $v;
        justify-content: $h;
    }
}

这是 app.scc

@use "./global.scss";


.App {
    width: 100vw;
    height: 100vh;
    @include flex-position(center, center);

    h1 {
        color: var(--base-color);
    }
}

这是错误:

在此处输入图片描述

css
  • 1 个回答
  • 44 Views
Martin Hope
Ahmed_08
Asked: 2024-12-17 19:14:43 +0000 UTC

为什么react项目创建时出现错误?

  • 6

大家好!创建 React 项目时出现以下错误:

Installing template dependencies using npm...
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/react
npm error   react@"^19.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^18.0.0" from @testing-library/[email protected]
npm error node_modules/@testing-library/react
npm error   @testing-library/react@"^13.0.0" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) 
dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:\Users\User\AppData\Local\npm-cache\_logs\2024-12-17T11_05_11_631Z-eresolve-report.txt

而且导入组件的时候也报错找不到文件。这以前没有发生过。我更新了node和npm的版本,但没有任何变化。请帮我弄清楚

javascript
  • 1 个回答
  • 57 Views
Martin Hope
Ahmed_08
Asked: 2024-10-25 21:55:37 +0000 UTC

为什么JS中样式值不显示? [复制]

  • 5
这个问题已经在这里得到回答:
为什么 style.backgroundColor 不起作用 (1 个回答)
昨天关门了。

我试图margin-left通过 JS 查看该值,但没有任何效果。可能是什么问题?

window.addEventListener('DOMContentLoaded', () => {
    const slides = document.querySelector('.sliders>.block');
    
    document.querySelectorAll('.sliders>.arrow').forEach(arrow => {
        arrow.addEventListener('click', () => {
            Array.from(slides.children).forEach(item => {
                console.log(item);
                console.log(item.style.marginLeft + ' px');
            });
        });
    });
});

这是结果:

javascript
  • 1 个回答
  • 29 Views
Martin Hope
Ahmed_08
Asked: 2024-01-12 22:39:17 +0000 UTC

如何找到最短路径?

  • 5

大家好!请帮我解决问题。来自 Yandex 的任务。第 15 次测试他失败了。这是任务的屏幕截图: 在此输入图像描述 在此输入图像描述

这里有几个例子: 在此输入图像描述

这是我的代码:距离函数返回一个映射,其中存储一对顶点以及它们之间的边的权重。接下来,在主函数中,为广度优先搜索构建了一个图。在图中,如果边权重大于 k,则顶点被视为不可到达。

#include <iostream>
#include <vector>
#include <map>
#include <limits>
#include <queue>

const std::map<std::pair<int, int>, long long> distance(std::vector<std::pair<int, int>>& v)
{
    std::map<std::pair<int, int>, long long> my_map;
    
    int size = v.size();
    for(int i = 0; i < size; ++i)
    {
        for(int j = i + 1; j < size; ++j)
        {
            std::pair<int, int> p;
            p.first = i+1;
            p.second = j + 1;
            my_map[p] = abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second);
        }
    }
    
    return my_map;
}

int bfs(std::vector<std::vector<int>>& graph, int k, int s, int e){
    const unsigned int INF = std::numeric_limits<int>::max();
    
    std::vector<int> dist(graph.size(), INF);
    std::queue<int> q;
    
    dist[s] = 0;
    q.push(s);
    
    while(!q.empty()){
        
        int v = q.front();
        q.pop();
        for(int to : graph[v]){
            if(dist[to] > dist[v] + 1){
                dist[to] = dist[v] + 1;
                q.push(to);
            }
        }
        
    }
    
    return dist[e] == INF ? -1 : dist[e];
}


int main()
{
    int amountCity;
    std::cin >> amountCity;

    std::vector<std::pair<int, int>> coordinats(amountCity);
    for(int i=0; i<amountCity; ++i)
    {
        std::cin>>coordinats[i].first>>coordinats[i].second;
    }
    
    int k, start, end;
    std::cin >> k >> start >> end;
    
    const std::map<std::pair<int, int>, long long> m = std::move(distance(coordinats));
    
    std::vector<std::vector<int>> v(amountCity);
    
    for(auto& [key, val]: m){
        if(val <= k){
            v[key.first-1].push_back(key.second-1);
            v[key.second-1].push_back(key.first-1);
        }
    }
    
    std::cout << bfs(v, k, start-1, end-1);
    


    return 0;
}
c++
  • 1 个回答
  • 81 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5