我正在使用Nginx 从初学者到专业人士。书中确认:
/etc/nginx/conf.d 文件夹包含两个文件: default.conf 和 example_ssl.conf 。
但是当我打开 /etc/nginx/conf.d 然后执行命令时,list我什么都没有,只有一些点,例如.. .这样的点出现,并且无法处理 - 既不能读取也不能打开。所以我想知道发生了什么以及为什么我的文件没有出现在目录中。在网上进行了一些搜索后,我没有发现任何与我相关的内容。此外,无法在此目录中创建文件夹或文件。
目前我已经创建了另一个文件夹,可能会用它来插入一些自定义配置。
我正在尝试在我的 html 文件上自动启动网络广播。目前使用自动播放失败,我假设收音机错过了加载一些数据的时间,因此自动播放会被阻止。我创建了一个 setTimeout 函数来处理这个问题。现在该功能拒绝在 Firefox 和 Opera 上启动。Firefox 的错误日志信息最为丰富,此处转载:
NotAllowedError:当前上下文中的用户代理或平台不允许播放方法,可能是因为用户拒绝了权限
这是我的 html 片段:
<body>
<audio controls src="http://5.63.151.52:7136/stream?icy=http" autoplay id="myAudio">
Your browser does not support the
<code>audio</code> element.
</audio>
<button onclick={goPlay()}>
Play
</button>
<script>
// function goPlay(){
// console.log("in goplay")
setTimeout(() => {
var x = document.getElementById("myAudio");
// function playAudio() {
x.play();
},
1000
)
// }
</script>
</body>Run Code Online (Sandbox Code Playgroud)
这种情况如何处理?
任何提示都会很棒,谢谢
这是我的React组件演示:https : //codesandbox.io/s/epic-brown-osiq1,我现在使用viewBox的值,getBBox并getBoundingClientRect()实现一些计算以定位元素。目前,我已根据控制台从getBoundingClientRect()日志中提供给我的收益输入了原始值。你可以看到,我已经实现了的元素getBoundingClientRect()上,即<svg>的根元素和clip-path的text的元素。更好,但text更多的地方是将屏幕的中心真正对准text框的中心,您可以看到“ So”一词位于“ Food”一词的开头,而不是对准的box的中心。所以我目前在这一点上。
注意:您会在沙箱中看到一些评论,这些评论提供了我的部分信息或以前的试用版。
我的代码是什么?具体来说,我显示的clip-path是带有一些动画面板的文本,这些动画面板在clip-path-上移动- color_panel_group's element可以使构图具有动态感。后面还带有阴影text可以使构图更深。
clip-path的text响应定位在垂直和水平的视口的中心。clip-path隐藏了的一部分,text而我尝试将元素相对于视口居中的操作却很费劲。x-主要元素的位置text,clip-path,symbol和这两个案例。甚至尝试use通过在其中实现某个类来使用该元素,但最终却得到了非常近似的结果。同样,在tspan和中,symbol我也尝试使用x的属性,再次取得了非常近似的结果。我尝试过使用position absolute-主要是relative container直接在SVG …大家好,我尝试在我的 reactJS 应用程序中实现getUserMedia来录制音频。
我努力将我的 mediaRecorder this.state 对象链接到状态更改,并使媒体设备 API 获得我提供应用程序所需的功能。
当我在视图上单击“开始记录”时,我的控制台返回给我:
TypeError: this.state.mediaRecorder.start is not a function
48 | startRecord() {
49 |
50 |
51 | this.setState({mediaRecorder:this.state.mediaRecorder.start()});
52 | alert("start record function started =, mediaRecorder state : " + this.state.mediaRecorder.state)
53 | console.log(this.state.mediaRecorder.state); // > recording
54 | console.log("recorder started"); View compiled
Run Code Online (Sandbox Code Playgroud)
这是我的 app.js :
import React from "react";
// import "./install.js" ;
import "./mediaDevices-getUserMedia-polyfill.js";
class RecorderAPI extends React.Component {
constructor(props) {
super(props);
this.handleDelete = this.handleDelete.bind(this);
this.startRecord = …Run Code Online (Sandbox Code Playgroud) 我将 ReactJS 与 NextJS 一起使用。当我尝试设置 a 时ref,我的控制台返回给我undefined,这怎么可能?如何解决这个困难呢?我尝试在网上阅读一些建议,但没有成功。
这是我的片段:
componentDidMount() {
this.myRef = React.createRef();
window.addEventListener('scroll', this.handleScroll, { passive: true })
}
componentWillUnmount() {
window.removeEventListener('scroll', this.handleScroll)
}
handleScroll(e) {
e.preventDefault();
// let offsetTop = this.myRef.current.offsetTop;
// here I'm trying just a console.log to preview the value
// otherwise my program will just crash
console.log("I'm scrolling, offsetTop: ", this.myRef)
}
render() {
return (
<div className={style.solution_container_layout} >
<div ref={this.myRef} className={style.solution_item}>
Run Code Online (Sandbox Code Playgroud)
任何提示都会很棒,谢谢
我想运行一个函数并在我的输入值中传递一些参数,但它给了我这个错误:
Invalid value for prop值on <input> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM.
我记得曾经在某处读过您可以在 中使用函数value,但这对我不起作用。还有别的办法吗。
value={() => this.handleMapping(row.servername, "Data Source Server")}
Run Code Online (Sandbox Code Playgroud)
错误:Invalid value for prop值on <input> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM.
我正在 Nextjs 中使用身份验证,我想知道在 NextJS 中处理身份验证的最佳策略是什么?
这里我的服务结构:
如果我理解得很好,我必须在 NextJS 中处理服务器端渲染,所以我知道我必须将 cookie 从我的外部服务器放到我的 NextJS 客户端,然后处理服务器端渲染检查。为此,我假设我必须在 NextJS 服务器和其他服务之间创建连接。在深入研究该主题之前,我会与您讨论可用的可能性。NextJS auth 似乎是一个普通开发的主题。
任何提示都会很棒,谢谢
如何使用 MailChimp API V3 过滤 http 响应?\n我正在 NodeJS 中工作。我正在尝试在 MailChimp API 中过滤“GET”请求的响应。
\n\n\xe2\x80\x8b
\n\n这是我的 snippet.js :
\n\n\xe2\x80\x8b
\n\nvar getList ="https://us18.api.mailchimp.com/3.0/lists/6b3d443365/members" \n\nrequest({\n url: getList,\n method: \'GET\',\n headers: {\n \'Content-Type\': \'application/json\',\n \'Authorization\': \'apikey \' + password\n },\n fields: ["id"], // I have also tried: "Fields"\n}, function(err, res, body) {\n if (err) {\n return console.log("err:", err)\n }\n console.log("connection succeed");\n console.log("res: ", body)\n});\nRun Code Online (Sandbox Code Playgroud)\n\n\xe2\x80\x8b
\n\n我也尝试过:
\n\n\xe2\x80\x8b
\n\n1-
\n\nfields:["members.id", "members.email_adress"]\nRun Code Online (Sandbox Code Playgroud)\n\n\xe2\x80\x8b
\n\n2-
\n\nfields:"id"\n …Run Code Online (Sandbox Code Playgroud) 我想知道为什么以下代码不起作用,毕竟它只是嵌套函数:
var calculus = new Promise((resolve, reject) => (resolve) => resolve(3))
var calculus2 = new Promise((resolve, reject) => {
() => resolve(4)
})
calculus.then((result) => console.log(result))
calculus2.then((result) => console.log(result))Run Code Online (Sandbox Code Playgroud)
任何提示都会很棒,谢谢
我不明白为什么:
我希望我的上下文可以直接在生命周期组件中访问,并且看到 ReactJS 提出了this.context's 方法来做到这一点。
这是我的沙箱
这是我的reactjs片段
import React, {Component}from "react";
import "./App.css";
// first we will make a new context
const MyContext = React.createContext();
// Then create a provider Component
class MyProvider extends Component {
state = {
name: 'Wes',
age: 100,
cool: true
}
render() {
return (
<MyContext.Provider value={{
state: this.state,
growAYearOlder: () => this.setState({
age: this.state.age + 1
})
}}>
{this.props.children}
</MyContext.Provider>
)
}
}
const Family = (props) => …Run Code Online (Sandbox Code Playgroud) 我正在使用 NextJS。我正在做一个布局。在我的布局中,有一些带有链接的导航组件。当我尝试在内部创建带有锚点的链接时,我的控制台会返回我:
Nextjs - Reactjs - 不变违规:React.Children.only 预期接收单个 React 元素子元素
然而,它只是 NextJS 的经典模式,这里是我的链接的示例:
<Link href={{pathname:'/blog'}} className={style.links_items}
to="/blog"> <a title="Blog">BLOG -</a></Link>
Run Code Online (Sandbox Code Playgroud)
只有当我这样做时它才有效:
<Link href={{pathname:'/blog'}} className={style.links_items}
to="/blog"> BLOG -</Link>
Run Code Online (Sandbox Code Playgroud)
但是后来,我收到了一个警告:
您直接在
<Link>. 此用法已被弃用。请添加一个<a>标签作为<Link>
如果有人有任何提示,那就太好了,
谢谢
我看过一些代码,其中的修饰符在注释中,这些注释突出显示了-请参见示例,该示例来自此代码,因此我想知道这些代码行是否有任何影响。这是一个例子:
/**
* Instanciate a new Payment.
* @param payplugApi Object The PayplugAPI with sucessfull authentication
* @param paymentTracker String A payment tracker (id) that will be send and received by PayPlug API to follow the payment. This tracked will be inserted in metadata
* @param payment Object The payment options. More informations here : https://www.payplug.com/docs/api/apiref.html?powershell#create-a-payment
* @return [nothing]
* @see PayPlugAPI.authenticate The authentication method
*/
var Payment = function () {...}
Run Code Online (Sandbox Code Playgroud)
它仅仅是文档还是执行代码?
任何提示都会很棒,谢谢!
我是 Redux 的新手。我想知道取消订阅监听器的本质是什么以及它是如何工作的?我知道 register 函数返回一个取消订阅,但是在下面的例子中,当我们调用 unsubscribe 方法时,为什么它不只是触发一个嵌套在变量中的新函数?我们可以看到:
let unsubscribe = store.subscribe(() => {
// let unsubscribe nests a function
// execute every time the state changes
const state = store.getState();
});
// but here instead of call the nested function it cancels the listener, how is it possible ?
unsubscribe();
Run Code Online (Sandbox Code Playgroud)
谢谢