不确定这个问题是否与升级到MacOs Sierra有关,但从那时起,当我运行'brew update'时会出现此错误
? brew update
Checking out v1.0.0 in /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask...
To checkout master in /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask run:
'cd /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask && git checkout master
fatal: Cannot update paths and switch to branch 'v1.0.0' at the same time.
Did you intend to checkout 'refs/tags/1.0.0' which can not be resolved as commit?
fatal: Needed a single revision
invalid upstream refs/tags/1.0.0
Checking out v1.0.0 in /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart...
To checkout master in /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart run:
'cd /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart && git checkout master
fatal: Cannot update paths and switch …Run Code Online (Sandbox Code Playgroud) 我有一个现有的 GatsbyJS 项目,我想将 Storybook 添加到该项目以展示每个单独的组件。我在我的项目中使用 SCSS,它正在编译gatsby-plugin-sass,效果很好。但是,我无法在 Storybook 中使用我的组件,因为它无法编译SCSS文件。
我按照 Storybook 和 GatsbyJS 的说明进行操作。这是我的 storybook/webpack.config.js 的样子:
module.exports = ({ config }) => {
// Transpile Gatsby module because Gatsby includes un-transpiled ES6 code.
config.module.rules[0].exclude =
[
/node_modules\/(?!(gatsby)\/)/,
];
// use installed babel-loader which is v8.0-beta (which is meant to work with @babel/core@7)
config.module.rules[0].use[0].loader = require.resolve('babel-loader');
// use @babel/preset-react for JSX and env (instead of staged presets)
config.module.rules[0].use[0].options.presets = [
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-env'),
];
config.module.rules[0].use[0].options.plugins = [
// use …Run Code Online (Sandbox Code Playgroud) 我已向用户信息添加了更多字段,但现在我正在努力保存一组值。
我如何显示值:
<tr>
<th><label for="days">days</label></th>
<td>
<input type="checkbox" name="days" value="<?php echo esc_attr( get_the_author_meta( 'monday', $user->ID ) ); ?>"> Monday<br>
<input type="checkbox" name="days" value="<?php echo esc_attr( get_the_author_meta( 'tuesday', $user->ID ) ); ?>"> Tuesday<br>
<input type="checkbox" name="days" value="<?php echo esc_attr( get_the_author_meta( 'wednesday', $user->ID ) ); ?>"> Wednesday<br>
<input type="checkbox" name="days" value="<?php echo esc_attr( get_the_author_meta( 'thursday', $user->ID ) ); ?>"> Thursday<br>
<input type="checkbox" name="days" value="<?php echo esc_attr( get_the_author_meta( 'friday', $user->ID ) ); ?>"> Friday<br>
</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我如何保存值:
update_user_meta($user_id, 'days', $_POST['monday, tuesday, wednesday, thursday, …Run Code Online (Sandbox Code Playgroud) 对于我的项目,我正在使用Drag&Drop库DropzoneJS.它工作得很好,但我希望有一个特定的功能(据我所见)不支持'开箱即用'.
在我的Dropzone配置中,我已经指定了acceptedFiles:
acceptedFiles: ".png,.jpg,.jpeg,.gif,.pdf"
Run Code Online (Sandbox Code Playgroud)
当我使用浏览按钮时,它会自动检查文件是否受支持.但是当我拖放文件时,检查是在上传完成后完成的,并显示带有错误消息的文件.
我想要实现的是拖放操作首先检查文件是否受支持,并自动丢弃不支持的文件.我仍然想显示一条错误消息,指出某些文件不受支持.
作为参考,这是我完整的Dropzone配置:
import Dropzone from 'dropzone';
export default class UI_DropZone {
constructor() {
if (document.querySelector('#dropZone')) {
let previewNode = document.querySelector("#template");
previewNode.id = "";
let previewTemplate = previewNode.parentNode.innerHTML;
previewNode.parentNode.removeChild(previewNode);
return new Dropzone("#dropZone", {
url: "/dist/files",
thumbnailWidth: 300,
thumbnailHeight: 300,
parallelUploads: 20,
maxFilesize: 10,
acceptedFiles: ".png,.jpg,.jpeg,.gif,.pdf",
previewTemplate: previewTemplate,
previewsContainer: '#previews',
clickable: '.fileinput-button',
autoProcessQueue: false
});
}
}
}
Run Code Online (Sandbox Code Playgroud)