小编raz*_*or7的帖子

这是什么意思......在React JSX中休息

看看这个React Router Dom v4示例https://reacttraining.com/react-router/web/example/auth-workflow我看到PrivateRoute组件破坏了这样的休息道具

const PrivateRoute = ({ component: Component, ...rest }) => (
  <Route {...rest} render={props => (
    fakeAuth.isAuthenticated ? (
      <Component {...props}/>
    ) : (
      <Redirect to={{
        pathname: '/login',
        state: { from: props.location }
      }}/>
    )
  )}/>
)
Run Code Online (Sandbox Code Playgroud)

我想确定这{ component: Component, ...rest }意味着:

props,获取Component prop,然后获取给你的所有其他道具,并重命名props为,rest这样你就可以避免使用传递给Route render函数的props的命名问题

我对吗?

reactjs react-router

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

将react-router v3迁移到v4

我目前正在尝试将react-react从v3迁移到v4,但是我无法完全掌握新概念,我的旧反应路由器v3代码看起来像这样,有人可以看看并给我一些提示吗?

谢谢!

<Router history={ browserHistory }>
     <Route path="/" component={ App }>
       <IndexRoute name="index" component={ Index } />
       <Route name="documents" path="/documents" component={ Documents } onEnter={ authenticate } />
       <Route name="newDocument" path="/documents/new" component={ NewDocument } onEnter={ authenticate } />
       <Route name="editDocument" path="/documents/:_id/edit" component={ EditDocument } onEnter={ authenticate } />
       <Route name="viewDocument" path="/documents/:_id" component={ ViewDocument } onEnter={ authenticate } />
       <Route name="login" path="/login" component={ Login } />
       <Route name="recover-password" path="/recover-password" component={ RecoverPassword } />
       <Route name="reset-password" path="/reset-password/:token" component={ ResetPassword } />
       <Route name="signup" …
Run Code Online (Sandbox Code Playgroud)

reactjs react-router

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

Meteor BrowserPolicy启用'blob:'来源

我启用了内容安全策略meteor包meteor/browser-policy-common

现在我从ostrio收到这个错误:与CSP相关的文件

拒绝从'blob:http:// localhost:3000/ef628f55-736b-4b36-a32d-b1056adfaa8c ' 创建一个worker,因为它违反了以下内容安全策略指令:"default- src'self'http :// fonts. googleapis.com https://fonts.googleapis.com http://fonts.gstatic.com https://fonts.gstatic.com http://code.ionicframework.com https://code.ionicframework.com ".请注意,'worker-src'未明确设置,因此'default-src'用作后备.

我的实际browser-policy-common配置看起来像这样

import { BrowserPolicy } from 'meteor/browser-policy-common';
// e.g., BrowserPolicy.content.allowOriginForAll( 's3.amazonaws.com' );
// BrowserPolicy.content.allowFontOrigin("data:");

BrowserPolicy.framing.disallow();
BrowserPolicy.content.disallowInlineScripts();
BrowserPolicy.content.disallowEval();
BrowserPolicy.content.allowInlineStyles();
BrowserPolicy.content.allowFontDataUrl();

const trusted = [
  'fonts.googleapis.com',
  'fonts.gstatic.com',
  'code.ionicframework.com',
];

_.each(trusted, (origin) => {
  BrowserPolicy.content.allowOriginForAll(origin);
});
Run Code Online (Sandbox Code Playgroud)

你能告诉我应该更改哪个配置以允许ostrio:文件blob:http:// localhost:3000 / ...工作?

非常感谢!

javascript meteor content-security-policy

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

PMA 4.5.2.0 file_exists():open_basedir限制生效

从PPA在我的Ubuntu服务器上安装phpMyAdmin之后

https://launchpad.net/~nijel/+archive/ubuntu/phpmyadmin

我收到一系列警告.提前致谢!

./libraries/Util.class.php#521 file_exists()中的警告:open_basedir限制生效.文件(doc/html/index.html)不在允许的路径中:(/ tmp /:/ usr/share/phpmyadmin /:/ etc/phpmyadmin /:/ var/lib/phpmyadmin /:/ usr /共享/ PHP/PHP-的gettext /:在/ usr /共享/ JavaScript的/:在/ usr /共享/ PHP/TCPDF /)

回溯

./libraries/Util.class.php#521:file_exists(字符串'doc/html/index.html')./ libs/sanitizing.lib.php#92:PMA_Util :: getDocuLink(string'faq',string'faq3 -11',)PMA_replaceDocLink(array)./libraries/sanitizing.lib.php#152:preg_replace_callback(string'/\[doc @([a-zA-Z0-9 _-] +)\] /',string' PMA_replaceDocLink',字符串'Podríaperaproximado.Pulse enelnúmeroparaobtener la cantidad exacta.Ver [doc @ faq3-11] FAQ 3.11.',)./ template/database/structure/table_header.phtml#43:PMA_sanitize(string 'Podríaperaproximado.Pulse enelnúmeroparaobtener la cantidad exacta.Ver [doc @ faq3-11] FAQ 3.11 [/ doc].')./ library /Template.class.php #80:include(./ templates/database/structure/table_header.phtml)./ library/controllers/DatabaseStructureController.class.php#224:PMA\Template-> render(array)./ db_structure.php#54:PMA\Controllers\DatabaseStructureController-> indexAction()

php mysql ubuntu phpmyadmin open-basedir

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

来自 Pressable TypeScript 错误的自定义 TouchableOpacity

有这个自定义 TouchableOpacity 函数组件,但对于 style prop 我收到了 TS 错误

\n
import { StyleSheet, Pressable, PressableProps, GestureResponderEvent } from 'react-native';\n\nexport default function TouchableOpacity(props: PressableProps) {\n  const { style, onPress, children } = props;\n\n  return (\n    <Pressable\n      onPress={(event: GestureResponderEvent) => {\n        onPress?.(event);\n      }}\n      style={({ pressed }) => [style, pressed ? styles.buttonPressedOpacity : null]}>\n      {children}\n    </Pressable>\n  );\n}\n\nconst styles = StyleSheet.create({\n  buttonPressedOpacity: {\n    opacity: 0.5,\n  },\n});\n
Run Code Online (Sandbox Code Playgroud)\n

以下是完整的 TS 投诉:

\n
\n

TS2322: 类型 '({ pressable}: PressableStateCallbackType) =>\n(StyleProp | ((state: PressableStateCallbackType) =>\nStyleProp<...>) | { ...; …

typescript react-native touchableopacity pressable

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