小编han*_*man的帖子

单击链接后为什么会出现链接下划线?

我有一个样式的锚标签 text-decoration: none.

这已经从我的链接中删除了下划线,这就是我想要的.

但是,在单击链接后,链接下划线下方的空格下会出现少量链接下划线.

我有类似的东西

<a ng-click="toggle(this)" style="text-decoration: none">
  <i class="fa fa-caret-down"  ng-if="!collapsed"></i>
  <i class="fa fa-folder-open-o" ng-if="!collapsed"></i>
  <i class="fa fa-caret-right"  ng-if="collapsed"></i>
  <i class="fa fa-folder-o" ng-if="collapsed"></i>
</a>
Run Code Online (Sandbox Code Playgroud)

(使用字体真棒图标)

下划线正好出现在图标之间的空白处.

有没有什么方法可以摆脱那个链接下划线一次又一次?!

html css css3

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

使用"npm audit"时如何检查高漏洞?

当你npm install使用新的npm 6执行时,我 收到一条消息,告诉我我有一些漏洞:

[!]发现75个漏洞[已审核4867个包]

严重程度:66低| 4中等| 5高

运行npm audit更多细节

我跑了npm audit但得到了一个截断的漏洞列表.

我如何只检查漏洞列表?

谢谢

node.js npm npm-audit

20
推荐指数
4
解决办法
3467
查看次数

如何在 remix run 中从实用程序函数重定向

我正在使用 Remix-run,我想从 auth 实用程序函数重定向到我的登录页面。但它不起作用。这是与我的身份验证实用程序方法类似的功能

import { redirect } from 'remix';

 async function authenticate(request){
  try{
    const user = await rpc.getUser(request);
    return user
  } catch(e){
   console.log(e) // logs error when rpc fails
   if(e.response.status === 401){
    return redirect('/login')
   }
   return redirect('/500')
  }
 }
Run Code Online (Sandbox Code Playgroud)

//component.jsx

import {useLoaderData } from 'remix';

export async function loader({ request }) {
  const user = await auth.authenticate(request);
  return { user };
}

export default function Admin(){
 const { user } = useLoaderData();
  return <h1>{user.name}</h1>
}

Run Code Online (Sandbox Code Playgroud)

如果 auth rpc 失败,我会在日志中收到错误消息。但重定向永远不会发生。如果我将 …

javascript reactjs server-side-rendering remix.run

11
推荐指数
1
解决办法
9883
查看次数

在我自己的文件夹结构中的 Sequelize 中的迁移

我是新手Sequelize,我当前的项目要求我将它与迁移一起使用。我熟悉迁移他们做什么以及如何。我来自Django后台,其中每个子应用程序在同一文件夹中都有模态、视图、api、url 和迁移。我喜欢这种结构,并希望在我的 nodejs 应用程序中保持相同。我想把一个功能放在一个地方。这对我来说更有意义。

我的结构

|---api
     |---user
     |    |--- api.js
     |    |--- utils.js
     |    |--- models.js
     |    |--- index.js
     |    |--- migrations
     |            |--- xxx123-migration.js
     |            |--- xxx1235-migration.js
     |---payment
          |--- api.js
          |--- utils.js
          |--- models.js
          |--- index.js
          |--- migrations
                  |--- xxx123-migration.js
                  |--- xxx1235-migration.js
Run Code Online (Sandbox Code Playgroud)

现在我的问题是我不知道如何Sequelize-cli指向我的文件夹并查找要生成和运行的迁移。

Sequelize-cli 为我不想遵循的模型、配置、种子等生成自己的文件夹。

任何帮助表示赞赏。

javascript node.js sequelize.js sequelize-cli

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

如何在 remix run 应用程序中加载 Svg 组件

我有一些 Svg 文件,我想将它们作为 React 组件加载到 remix run 应用程序中。例如在create-react-app中你可以做这样的事情


import { ReactComponent as Logo } from './logo.svg';
function App() {
  return (
    <div>
      {/* Logo is an actual React component */}
      <Logo />
    </div>
  );
}
Run Code Online (Sandbox Code Playgroud)

remix-run 中是否有类似的方法可以达到相同的效果?

svg reactjs svg-rect remix.run

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

如何实现新的react-redux v6.0.0

我试图迁移react-redux v5.X.Xv6.0.0该站点,似乎没有任何文档。我正在使用以下版本: "react": "^16.4.2" "redux": "^4.0.0" "react-redux": "^6.0.0"

官方更改日志说。

不再支持将存储作为道具传递给已连接的组件。相反,您可以向和都传递自定义context = {MyContext}属性。您也可以通过{context:MyContext}作为连接选项。链接在这里

这是我的根 index.jsx

import React from 'react';
import ReactDOM from 'react-dom';
import { configureStore, history } from './Store';
import App from './App.hot';

import 'antd/dist/antd.min.css';
const reduxStore = configureStore();
ReactDOM.render(<App store={reduxStore} history={history} />, document.getElementById('root'));
Run Code Online (Sandbox Code Playgroud)

这是我的app.jsx(根组件)

import React from 'react';
import PropTypes from 'prop-types';
import { Provider, connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { ConnectedRouter } from 'connected-react-router';
import …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-redux react-context

7
推荐指数
1
解决办法
5224
查看次数

MiniCssExtractPlugin公共路径不起作用

我正在使用MiniCssExtractPlugin在我的react应用程序中延迟加载css文件.

我已经为MiniCssExtractPlugin提供了publicPath选项,但它没有采用此选项值,它采用了output.publicPath选项.

config:
   {
     test: /\.(css)?$/,
     use: [{
            loader : MiniCssExtractPlugin.loader,
            options : {
              publicPath : '../'
            }
          },
          'css-loader'
        ],

     }
Run Code Online (Sandbox Code Playgroud)

任何帮助???

webpack-4 mini-css-extract-plugin

6
推荐指数
1
解决办法
6732
查看次数

React功能组件在渲染时重新初始化局部函数和变量(React Hooks)

所以我现在开始使用React钩子。我已经尝试使用API​​一段时间了。我真的很喜欢将状态引入功能组件的想法。但是有一件事情一直困扰着我,当我尝试使用它时,它在肠道中感觉不正确。我尝试过发布,RFCs但现在那里太拥挤了。一切似乎都在那里丢失了。

这是我的示例中的一段代码。

import React, { useState } from "react";

function Counter() {
  const [counterState,incrementCounterState] =  useCommontState(0); 

  function doSomething (){
   // does something and then calls incrementCounterState
   // with the updated state.
  }

   return (
    <div>
      <p>{counterState}</p>
      <button onClick={incrementCounterState}>increase</button>
      ....
      .... // some jsx calling local scoped functions.
      ....
    </div>
    );
}

function useCommontState(defaultValue){
  var [state, setState] = useState(0);
  function increment(){
    setState(defaultValue+=1);
  }
  return [state, increment]
}

export default Counter;
Run Code Online (Sandbox Code Playgroud)

我可以很容易地取出statesetState方法,并创建自定义的hook,但我的问题是由该组件使用的本地功能。由于状态现在是组件的一部分,因此在某些情况下,某些逻辑将决定下一步如何处理状态。

同样,当组件在状态更改时重新呈现时,所有内容都会重新初始化。这是我的问题。我知道这useState …

javascript reactjs react-hooks

5
推荐指数
1
解决办法
1189
查看次数

以角度 6 获取 IFrame img

我的 Angular 应用程序中有一个 iframe。iframe 具有 base64 格式的图像。现在我正在尝试获取该图像的 base64 代码并将其存储在父页面/Angular 应用程序的变量中。请问有人可以帮忙吗?我找到了这篇文章

如何使用 Angular 6 从 Iframe 获取数据

这是我的 iframe 的 HTML 代码

<iframe src="http://eohdigitalappstore.co.za/test/test.html"></iframe>
Run Code Online (Sandbox Code Playgroud)

通过能够在 iframe 页面中获取元素,我设法取得了进一步的进展,但现在我正在尝试获取元素树中的图像

const doc =  this.iframe.nativeElement.contentDocument || this.iframe.nativeElement.contentWindow;
console.log(doc.body);
Run Code Online (Sandbox Code Playgroud)

我可以指向如下所示的 HTML 元素树 在此处输入图片说明

typescript angular

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

提供应用程序名称时,不会激活AngularJS解析器

使用AngularJS,以下html代码打印{{1 + 1}}而不是2

<!doctype html>
<html lang="en" ng-app="myApp">
<head>
    <script src="/js/angular.min.js"></script>
</head>
<body>
{{1+1}}
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

如果我删除下面的"myApp",它会正确打印2.

<!doctype html>
<html lang="en" ng-app>
<head>
    <script src="/js/angular.min.js"></script>
</head>
<body>
{{1+1}}
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

html javascript angularjs

4
推荐指数
1
解决办法
1921
查看次数

带有 React 的 Google 地图-“缺少必需的道具 loadingElement 或 googleMapURL。您需要同时提供它们”

下午,我正在尝试在 REACT 中渲染谷歌地图(带有图钉或标记) - 我一直在关注本教程:

https://medium.com/@morgannegagne/google-maps-with-react-951c12b723ad

但是我不断收到同样的错误:

“缺少必需的道具 loadingElement 或 googleMapURL。您需要同时提供它们”

我知道这不是我的 googleAPI 密钥,因为在我正在构建的站点上有另一个基本的 g-map,它呈现得很好。但是在我尝试将“旅行文章”引脚添加到 gmap 的部分中 - 事实证明它很棘手:代码如下所示:

import React from "react";
import ArticleMarker from "./ArticleMarker";
import ArticleMapContainer from "./ArticleMapContainer";
import {
  withScriptjs,
  withGoogleMap,
  GoogleMap,
  Marker,
  } from 'react-google-maps';

const ArticlesMap = withScriptjs(withGoogleMap((props) =>{

  const markers = props.articles.map( article =>
                <ArticleMarker
                  key={article.uid}
                  doctor={article}
                  location={{lat: article.closestArticle.lat, lng: article.closestArticle.lon}}
                />);
  return (
      <GoogleMap
        defaultZoom={14}
        center={ { lat:  42.3601, lng: -71.0589 } }
        >
        {markers}
      </GoogleMap>
    );
  }
))

export default ArticlesMap; …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps markers reactjs

2
推荐指数
2
解决办法
4086
查看次数