小编Jam*_*mie的帖子

订购Wordpress样式表?

我有一个wordpress主题和一个需要最后加载的样式表,因为插件css干扰了我的主题.我想知道是否有某种类型的函数可以用来使主样式表在我的主题中加载到最后.

css wordpress function stylesheet

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

React material-ui 选择菜单上的 findDOMNode 错误

我在这里使用select 组件的精确标记

        <FormControl
            variant="outlined"
            className={classes.formControl}
            error={errors.title ? true : false}
          >
            <InputLabel htmlFor="title">Who are you?</InputLabel>
            <Select
              labelId="titleLabel"
              id="title"
              value={state.title ? state.title : 'Example1'}
              onChange={handleChange}
              label="Who are you?"
            >
              <MenuItem value={`Example1`}>Example1</MenuItem>
              <MenuItem value={`Example2`}>Example2</MenuItem>
              <MenuItem value={`Example3`}>Example3</MenuItem>
              <MenuItem value={`other`}>other</MenuItem>
            </Select>
            {errors.title && <FormHelperText>{errors.title}</FormHelperText>}
          </FormControl>
Run Code Online (Sandbox Code Playgroud)

然后我不断收到以下错误,不知道如何解决这个问题

index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely …
Run Code Online (Sandbox Code Playgroud)

reactjs material-ui

12
推荐指数
1
解决办法
5647
查看次数

列和内联中心图像

我想创建一个2文本列,中间有一个div,如下所示.

我正在使用此代码:

-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
Run Code Online (Sandbox Code Playgroud)

当我在div类中放置另一个div时,它会格式化为两列.我该如何解决?

html css

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

在 postcss 和 rollup 中创建单独的 CSS 文件

我希望css在 JS 中导入的每个文件都为我的构建创建一个新的 css 文件。例如:

import "./app.css";
import "./admin.css";
Run Code Online (Sandbox Code Playgroud)

将创建dist/app.cssdist/admin.css。我正在使用汇总,这是我的配置文件:

import commonjs from "@rollup/plugin-commonjs";
import postcss from "rollup-plugin-postcss";
import resolve from "@rollup/plugin-node-resolve";
import { terser } from "rollup-plugin-terser";

import postcssImport from "postcss-import";
import postcssNested from "postcss-nested";
import autoprefixer from "autoprefixer";

const dev = process.env.WP_ENV === "development";

export default {
  input: "src/main.js",
  output: {
    sourcemap: dev,
    format: "iife",
    name: "main",
    file: "dist/main.bundle.js",
  },
  plugins: [
    resolve({
      browser: true,
    }),
    postcss({
      plugins: [postcssImport(), postcssNested(), autoprefixer()],
      extract: …
Run Code Online (Sandbox Code Playgroud)

css build postcss rollupjs

8
推荐指数
1
解决办法
9649
查看次数

vanilla javascript vs jquery

我很难理解两者之间的差异.我尝试下载库,没有代码.我正在尝试构建一个基本的滑块以及我在jQuery中构建的其他基本功能.任何帮助,教程,插件和信息都会非常有用!

javascript jquery

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

自定义和添加 woocommerce 模板数据

我在自定义 WordPress 主题中的 woocommerce 模板时遇到一些问题。我想在我的模板中添加额外的数据作为变量。

我想在仪表板/我的帐户页面上显示活动订单。我想通过按顺序将数据变量传递到模板以便能够调用来实现此目的,就像在模板中完成的那样orders.php

我知道我可以覆盖我的主题中的 ,然后在仪表板或我的帐户的函数wc-template-functions.php中添加数据。wc_get_templates但是,我不想这样做。

我尝试过创建一个钩子,例如:

函数.php

function wc_fr_add_orders_to_account( $fr_account_orders, $current_page ) {
  global $fr_account_orders;
  $current_page = empty( $current_page ) ? 1 : absint( $current_page );

  $customer_orders = wc_get_orders( apply_filters( 'woocommerce_my_account_my_orders_query', 
    array( 
      'customer' => get_current_user_id(), 
      'page' => $current_page, 
      'paginate' => true,
      'status' => array( 'wc-pending' )
      ) ) );

  $fr_account_orders = array(
    'current_page' => absint( $current_page ),
    'customer_orders' => $customer_orders,
    'has_orders' => 0 < $customer_orders->total
  );

  return $fr_account_orders;
}
add_action( 'woocommerce_account_content', …
Run Code Online (Sandbox Code Playgroud)

php wordpress hook templates woocommerce

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

访问 jwt-decode 对象时出现打字稿错误

我已经安装@types/jwt-decode,但无法正常工作。

import jwtDecode from 'jwt-decode'

...
let decodedToken = jwtDecode(token);
console.log(decodedToken) // this works! I can see the full object
console.log(decodedToken.exp) // error Object is of type 'unknown'.ts(2571)
Run Code Online (Sandbox Code Playgroud)

jwt typescript

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

使用 Jest + Enzyme 测试放大身份验证

我对测试很陌生,我终于觉得自己掌握了窍门。然而,mocks 仍然有点令人困惑。我目前正在测试一个注册功能,这些功能一直执行到Auth.signUp. 我不确定我是否需要在我的测试中模拟某些东西,或者我是否需要它来运行不同的测试。

async function signUp(
  { first, last, email, password }: SignupUserType,
  dispatch: Dispatcher,
  formContent: FormContentType,
  setFormContent: SetFormContent,
) {
  console.log('signing in init...');
  dispatch({ type: 'INIT' });

  try {
    const user = await Auth.signUp({
      username: email,
      password,
      attributes: {
        given_name: first,
        family_name: last,
        picture: userImage,
      },
    });
    console.log('sign up success!');
    dispatch({ type: 'STOP_LOADING' });
    console.log(formContent);
    setFormContent(formContent);
  } catch (err) {
    console.log('error signing up...', err);
    dispatch({ type: 'ERROR', error: err.message, doing: 'SIGNUP' });
  }
}
Run Code Online (Sandbox Code Playgroud)

测试

import Amplify, …
Run Code Online (Sandbox Code Playgroud)

reactjs jestjs enzyme aws-amplify

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

vscode phpcs:引用的嗅探Universal.WhiteSpace.DisallowInlineTabs不存在

我在设置时遇到了很多问题phpcsvscode\xe2\x80\x94 它们工作了一段时间,但在重新组织一些文件夹后,我将我的wpcs存储库移到了其他地方。现在尝试重新配置phpcs,但无法找出问题所在。Universal.WhiteSpace.DisallowInlineTabs我不断收到不存在的错误。这是屏幕截图\n在此输入图像描述

\n

知道发生了什么事吗?

\n

visual-studio-code phpcs

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

当不进行樱桃采摘时,之前的樱桃采摘现在为空

我正在尝试使用 删除提交列表git rebase -i HEAD~19。我过去曾成功地使用过此方法,但是当我尝试运行然后退出vim而不进行任何更改(:q!)时,我收到此错误:

The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git cherry-pick --skip'
interactive rebase in progress; onto dd0b851
Run Code Online (Sandbox Code Playgroud)

我不是在挑选,也不知道为什么我会遇到要跳过的错误。

git rebase cherry-pick

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

使用导入与必需进行反应

我目前正在学习 React,并且我有一个使用 webpack、babel 和 React 的应用程序。看来 React 有两种使用 或 来编写它的required方法import。似乎还有更多关于使用的文档import。如何更改我的堆栈以使用导入版本?

reactjs

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