如果我使用浏览器以 PUBLIC(未经身份验证的用户)身份访问 localhost:1337/api/events,我会收到以下返回信息:
{"data":[{"id":1,"attributes":{"name":"Throwback Thursday with DJ Manny Duke","slug":"throwback-thursday-with-dj-manny-duke","venue":"Horizon Club","address":"919 3rd Ave New York, New York(NY), 1002","date":"2022-07-20T02:00:00.000Z","time":"10:00 PM","createdAt":"2022-04-12T02:05:08.246Z","updatedAt":"2022-04-12T02:17:16.760Z","publishedAt":"2022-04-12T02:05:16.192Z","performers":"DJ Manny Duke","description":"Description for the vent of DJ Manny Duke"}},{"id":2,"attributes":{"name":"Boom Dance Festival Experience","slug":"boom-dance-festival-experience","venue":"Blackjacks","address":"123 Lexington","date":"2022-04-25T16:00:00.000Z","time":"8:00 PM","createdAt":"2022-04-12T02:26:32.123Z","updatedAt":"2022-04-12T02:26:33.540Z","publishedAt":"2022-04-12T02:26:33.538Z","performers":"DJ LUKE, DJ BLACKJACK","description":"Whatever Description"}},{"id":3,"attributes":{"name":"Encore Night Boat Party","slug":"encore-night-boat-party","venue":"Encore","address":"12343 New York","date":"2022-11-14T16:00:00.000Z","time":"7:00 PM","createdAt":"2022-04-12T02:28:06.028Z","updatedAt":"2022-04-12T02:28:36.292Z","publishedAt":"2022-04-12T02:28:07.622Z","performers":"BAD BOY BILL","description":"Description of Encore"}}],"meta":{"pagination":{"page":1,"pageSize":25,"pageCount":1,"total":3}}}
Run Code Online (Sandbox Code Playgroud)
但是,当我使用 Next.JS 访问相同的链接时,我得到:
FetchError: request to http://localhost:1337/api/events failed, reason: connect ECONNREFUSED ::1:1337
Run Code Online (Sandbox Code Playgroud)
为什么 Strapi 拒绝连接?怎么修?
配置/index.js
export const API_URL =
process.env.NEXT_PUBLIC_API_URL || 'http://localhost:1337'
Run Code Online (Sandbox Code Playgroud)
页面/index.js
...
export async function getStaticProps() {
const res = await …Run Code Online (Sandbox Code Playgroud) 我使用jQuery来处理dropzone.例如
$("#mydropzone").dropzone({ /*options*/ });
Run Code Online (Sandbox Code Playgroud)
我需要获取Dropzone实例,以便我可以调用此方法:
myDropzone.processQueue()
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?可能吗?
换句话说,我如何初始化drop zone使用
$("#mydropzone").dropzone({ url: "/file/post" });
Run Code Online (Sandbox Code Playgroud)
但同时获取对象的实例,就好像我使用以下内容初始化它:
var myDropzone = new Dropzone("#mydropzone", { url: "/file/post"});
Run Code Online (Sandbox Code Playgroud)
所以我可以打电话:
myDropzone.processQueue()
Run Code Online (Sandbox Code Playgroud)
非常感谢你.
我在 React Native 应用程序中使用 react-navigation。
我不断收到一个错误,该错误应该是仅用于开发的警告,不会在生产中显示。
我如何修复下面的错误?
console.error: "The action 'NAVIGATE' with payload
{"name":"192.168.100.189:19000","params":{}} was not handled by any
navigator.
Do you have a screen named '192.168.100.189:19000'?
If you'r trying to navigate to a screen in a nested navigator, see
https://reactnavigation.org/docs/nesting-navigators#navigating-to-a-screen-in-a-nestd-navigator.
This is a development-only warning and won't be shown in production."
Run Code Online (Sandbox Code Playgroud) 在简单的旧Semantic-UI WITHOUT React中,我已经能够将一个表单放在一个Modal中而没有任何问题.
使用Semantic-UI + React版本,我能够在模态中显示表单,但它不会像我期望的那样工作.
例如,在模态显示之后,也会显示模态内的表格.如果我在输入字段中开始输入,我会显示以下错误:
Error: Invariant Violation: findComponentRoot(..., .1.1.1.0.4.0.0.1): Unable to find element. This probably means the DOM was unexpectedly mutated (e.g., by the browser), usually due to forgetting a <tbody> when using tables, nesting tags like <form>, <p>, or <a>, or using non-SVG elements in an <svg> parent. Try inspecting the child nodes of the element with React ID ``.
Run Code Online (Sandbox Code Playgroud)
由于这个错误,我使用输入的其他反应代码不能按预期工作.
这是演示此问题的最简单的代码版本:
ConfirmEdit = React.createClass({
render(){
return (
<div className="ui modal editform">
<form className="ui form">
<div …Run Code Online (Sandbox Code Playgroud) 为什么使用Redux Thunk然后可以做这样的事情:
ReadableAPI.getCategories().then((categories)=>{
console.log('after getCategories', categories)
this.props.dispatch(addCategories(categories))
})
Run Code Online (Sandbox Code Playgroud)
这不是更直接,并实现同样的事情?
编辑器正在显示
类型“Promise”不可分配给类型“void |” 析构函数'。
对于 useEffect 中的 checkUserLoggedIn() 调用。
我可以通过执行 const checkUserLoggedIn:any 来摆脱它
然而也许这不是解决这个问题的最理想的方法......
如果我执行 const checkUserLoggedIn:Promise ,则会收到不同的错误:
该表达式不可调用。类型“Promise”没有呼叫签名。
这不是我想要的...我希望它是可调用的...我正在将我的 javascript 文件翻译/转换为打字稿......
useEffect(() => checkUserLoggedIn(), [])
// Check if user is logged in
const checkUserLoggedIn = async () => {
console.log('checkUserLoggedIn')
const res = await fetch(`${NEXT_URL}/api/user`)
const data = await res.json()
if (res.ok) {
setUser(data.user)
console.log('data.user', data.user)
router.push('/account/dashboard')
} else {
setUser(null)
}
}
Run Code Online (Sandbox Code Playgroud) javascript promise typescript typescript-generics react-typescript
我正在尝试建立一个带有管理页面的电子商务网站,管理员可以上传某些产品的图像.我希望Meteor将这些图像上传到文件夹,然后在该产品的产品页面中显示这些图像.
我知道通常客户端将使用的图像文件应该在'public'文件夹中,但我想知道更多关于我可能有的其他选项.
另外,如果我将一个新文件上传到'public'文件夹,或者如果我删除'public'文件夹中的文件,那么该网站会自行更新...这是好的和坏的同时取决于你是什么影响后....
这是我的问题:
非常感谢你的帮助
我正在使用Meteor JS ...并且在我的Meteor应用程序中我使用节点来查询应用程序内不同目录的内容....
当我使用process.env.PWD查询文件夹的内容时,我得到的结果与使用process.cwd()查询文件夹结果时的结果不同.
var dirServer = process.env.PWD + '/server/';
var dirServerFiles = fs.readdirSync(dirServer);
console.log(dirServerFiles); //outputs: [ 'ephe', 'fixstars.cat', 'sepl_30.se1', 'server.js' ]
Run Code Online (Sandbox Code Playgroud)
VS
var serverFolderFilesDir = process.cwd() +"/app/server";
var serverFolderFiles = fs.readdirSync(serverFolderFilesDir);
console.log(serverFolderFiles); //outputs: [ 'server.js' ]
Run Code Online (Sandbox Code Playgroud)
使用process.cwd()只显示Meteor中的'server.js'.
为什么是这样?process.cwd()与process.env.PWD有什么不同?
由于某种原因,我无法再在我的项目上进行 NPM 安装,因为我收到以下消息:
SOLINK_MODULE(target) Release/.node
clang: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX' [-Wincompatible-sysroot]
ld: warning: building for macOS, but linking in .tbd file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/lib/libc++.tbd) built for iOS Simulator
ld: warning: building for macOS, but linking in .tbd file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/lib/libSystem.tbd) built for iOS Simulator
ld: warning: building for macOS, but linking in .tbd file (/usr/lib/system/libcache.dylib) built for iOS Simulator
ld: warning: building for macOS, but linking in .tbd file (/usr/lib/system/libcommonCrypto.dylib) built for iOS Simulator
ld: warning: building for macOS, …Run Code Online (Sandbox Code Playgroud) 我越来越
iOS Simulator 部署目标:'IPHONEOS_DEPLOYMENT_TARGET' 设置为 5.0,但支持的部署目标版本范围为 8.0 到 13.5.99。(在项目“Pods”的目标“CocoaAsyncSocket”中)。
当我打开 Xcode 并转到 General 然后在 Deployment Info 下,Target 是 iOS9.0,旁边是一个复选框,旁边有 iPhone 一词。
如何更改 iOS 模拟器的“IPHONEOS_DEPLOYMENT_TARGET”?
javascript ×5
node.js ×3
react-native ×3
reactjs ×3
meteor ×2
android ×1
dropzone.js ×1
file-upload ×1
fs ×1
image ×1
ios ×1
jquery ×1
modal-dialog ×1
next.js ×1
npm ×1
promise ×1
react-redux ×1
redux-thunk ×1
semantic-ui ×1
strapi ×1
typescript ×1
xcode ×1