我使用jQuery对话框打开表.他们中的一些人有大量的文字,他们往往太长,离开屏幕.如果表格太长,就像小提琴中的第一个那样,如何使对话框更宽?我试过width:'auto'但似乎只是占据了整个屏幕.
HTML:
<button class='label'>Click</button><div class='dialog'><p><table>.....</table></div>
<button class='label'>Click</button><div class='dialog'><p><table>.....</table></div>
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
$(document).ready(function(){
$('.label').each(function() {
var dialogopen = $(this).next(".dialog");
dialogopen.dialog({width:'auto',autoOpen: false,modal: true,
open: function(){
jQuery('.ui-widget-overlay').bind('click',function(){
dialogopen.dialog('close');
})
}
});
$(this).click(function(){
dialogopen.dialog('open');
return false;
}
);
});
});
Run Code Online (Sandbox Code Playgroud) 我正在使用graphql + mysql + react-apollo,这里是User表格的graphql类型之一:
type User {
id: ID!
name: String!
}
Run Code Online (Sandbox Code Playgroud)
我有问题ID scalar type的graphql是,当主键,它是作为一个字符串返回int在MySQL和它创造与打字稿前端某种类型的冲突.
我可以根本不使用ID标量类型,因为我已经dataIdFromObject为Apollo Client中的每个对象设置了一个唯一标识符:
import {InMemoryCache} from 'apollo-cache-inmemory';
const apolloMemoryCache = new InMemoryCache(
{
dataIdFromObject: ({id,__typename}) => {
return __typename+id
}
}
);
const client = new ApolloClient({
link: ApolloLink.from([authLink, httpLink]),
cache: apolloMemoryCache,
});
Run Code Online (Sandbox Code Playgroud)
你会保留ID类型还是只丢弃它?
我在80上使用HAProxy监听将请求发送到节点服务器(端口:3000)或php服务器(4000); 我也安装了CSF,它有3000和80端口可用.
当我浏览页面时它可以正常工作http://example.com/forum/1/page.php,但有时当我不小心进入example.com/forum/1(没有尾部斜杠)时,它会继续加载并最终导致错误页面ERR_CONNECTION_TIMED_OUT.地址栏显示已重定向到http://example.com:4000/forum/1/.
由于我没有打开4000端口,当我继续example.com/forum/1多次时,它会触发CSF阻塞.我的问题是,我可以将指向实际文件夹example.com/forum/1(没有尾部斜杠)的所有请求重定向到404页面吗?我已经尝试添加重写规则来为每个请求附加一个尾部斜杠,但这会破坏我所有的相对路径(请参阅我在本文中的问题).
所以我想知道的是,为什么我会重定向到http://example.com:4000/forum/1/的http://example.com/forum/1?它是由HAproxy引起的吗?
一些HAproxy配置:
frontend all 0.0.0.0:80
timeout client 1h
# use apache2 as default webserver for incoming traffic
default_backend apache2
backend apache2
balance roundrobin
option forwardfor
server apache2 myIpAddress:4000 weight 1 maxconn 1024 check
# server must be contacted within 5 seconds
timeout connect 5s
# all headers must arrive within 3 seconds
timeout http-request 3s
# server must …Run Code Online (Sandbox Code Playgroud) 我已经安装了react-native-firebase和react-native-camera.当play-services -vision被卡住时相机很好12.0.1,但是我遇到了这个错误(错误更新属性googleVisionBarcodeDetectorEnable) https://github.com/react-native-community/react-native-camera/issues/1844这需要升级到15.0.2.
它看起来像有谷歌播放服务,并在火力地堡冲突play-services-vision被撞可达15.0.2来自12.0.1:
Dependency failing: com.google.android.gms:play-services-flags:15.0.1 -> com.google.android.gms:play-services-basement@[
15.0.1], but play-services-basement version was 16.0.1.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-messaging@17.3.4
-- Project 'app' depends onto com.google.android.gms:play-services-base@16.0.1
-- Project 'app' depends onto com.google.firebase:firebase-core@16.0.6
-- Project 'app' depends onto com.google.android.gms:play-services-vision@15.0.2
Run Code Online (Sandbox Code Playgroud)
我试过com.google.android.gms:play-services-vision@16.2.0但它给了我exceed 64k methods …
我的项目结构:
/website
/node
/node_module <<-- library root
/type_src <<-- ts files
/src <<-- compiled js files
Run Code Online (Sandbox Code Playgroud)
我曾经能够像这样自动导入根节点模块:
/type_src/store/BaseStore.ts:
import {observer} from "mobx-react/native";
@observer
class BaseStore{
}
Run Code Online (Sandbox Code Playgroud)
但最近,自动导入为这些节点模块生成相对路径:
import {observer} from "../../node_modules/mobx-react/index";
@observer
class BaseStore{
}
Run Code Online (Sandbox Code Playgroud)
生成的唯一方法import {observer} from "mobx-react/native";是等待红灯泡出现,这不方便.
我已经创建了另一个项目,它工作正常,但我不知道为什么这个项目突然出现这个问题.任何人都可以帮我解决这个问题吗?
tsconfig:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"moduleResolution": "node",
"removeComments": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"sourceMap": true,
"outDir": "./src",
"jsx": "react",
"experimentalDecorators": true,
"noLib": false,
"declaration": false,
"emitDecoratorMetadata": true,
"lib": ["es6", "dom"],
"types": ["reflect-metadata"]
},
"exclude": [ …Run Code Online (Sandbox Code Playgroud) 我想foreign object在人们放大圆圈时插入一个.我知道有一个Insert before:
function zoom(d, i) {
d3.select("g").insert("foreignObject",'#'+d.name) // insert after a circle in the group
.attr("width",450)
.attr("height",450)
.attr("id",'f_'+d.name)
.append("xhtml:div")
.html(content)
}
Run Code Online (Sandbox Code Playgroud)
但是点击的圈子会使html内容变得模糊不清.有没有insert after a specific sibling这样的外部对象会在它之后插入?
不要打扰罗伯特·朗森的回答.他只是拿了他在文件中读到的东西而没有证明有效.
@代码:
var w = 1280,
h = 800,
r = 720,
x = d3.scale.linear().range([0, r]),
y = d3.scale.linear().range([0, r]),
node,
root;
var pack = d3.layout.pack()
.size([r, r])
.value(function(d) { return d.size; })
var vis = d3.select("body").insert("svg:svg", "h2")
.attr("width", w)
.attr("height", h)
.append("svg:g")
.attr("transform", "translate(" + (w …Run Code Online (Sandbox Code Playgroud) 我正在使用serviceworker-webpack-plugin在我的 reactjs 应用程序中创建一个服务工作者。
我已经按照示例在主线程中注册了服务工作者。我了解到这Html5 Notification不适用于 Android chrome,所以我使用registration.showNotification('Title', { body: 'Body.'});而不是new Notification('...')推送通知。但是当我在桌面 chrome 上测试它时,它抛出了这个错误
registration.showNotification is not a function
Run Code Online (Sandbox Code Playgroud)
registration.showNotification 是否仅在 Android chrome 上可用而在桌面上不可用?
public componentDidMount(){
if ('serviceWorker' in navigator &&
(window.location.protocol === 'https:' || window.location.hostname === 'localhost')
) {
const registration = runtime.register();
registerEvents(registration, {
onInstalled: () => {
registration.showNotification('Title', { body: 'Body.'});
}
})
} else {
console.log('serviceWorker not available')
}
}
Run Code Online (Sandbox Code Playgroud) 通过使用phpredis,我在分页中保存了一些数据,如下所示:
review/itemA/1
review/itemA/2
Run Code Online (Sandbox Code Playgroud)
其中1和2是页码。我在文档中读到您可以使用通配符来检索多个键。
$allKeys = $redis->keys('*'); // all keys will match this.
$keyWithUserPrefix = $redis->keys('user*');
Run Code Online (Sandbox Code Playgroud)
但是,当有人发布新评论时,我是否也可以使用通配符删除所有旧密钥?我可以做这样的事情:
$redis->delete('review/itemA/*'); // or $redis->delete('review/itemA*')
Run Code Online (Sandbox Code Playgroud)
然而它并没有奏效。
我一直在学习制作自定义 Markdown 编辑器。然而,我刚刚遇到了在用降价包装之前获取突出显示的文本的问题。这是我的例子
class TextArea extends React.Component {
constructor(props){
super(props);
this.state = {
comment:'He oppose at thrown desire of no. Announcing impression unaffected day his are unreserved indulgence.She oppose at thrown desire of no..'
};
this.onClickMakeBold = this.onClickMakeBold.bind(this);
}
render(){
return <div>
<button onClick={this.onClickMakeBold}>Bold</button>
<div>
<textarea ref="textarea">{this.state.comment}</textarea>
</div>
</div>
}
onClickMakeBold(){
console.log(getSelectionText())
}
}
function getSelectionText() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control"){
text = document.selection.createRange().text;
}else{ …Run Code Online (Sandbox Code Playgroud) 我正在研究在反应网页和反应本机网络视图之间传递数据。我想在网页加载后向移动设备上的 React-Native WebView 发送信号。
我想知道为什么在反应网页上,window.postMessage()除非与 一起使用,否则不起作用setTimeout。控制台中完全没有错误,但必须延迟大约 500 才能工作。谁能解释一下吗?我更喜欢回避,setTimeout因为感觉不可靠。
@observer
class TalkToMobile extends React.Component {
@observable message;
render() {
return (
<div>
{
message ?
<Editor data={this.message}/>: null
}
</div>
)
}
componentDidMount() {
document.addEventListener('message', (e: any) => {
if (e.data) {
this.message = JSON.parse(e.data);
}
});
let payload = {};
payload.command = "giveMeData";
window.postMessage(JSON.stringify(payload), "*")
/*
setTimeout(()=>{
let payload = {};
payload.command = "giveMeData";
window.postMessage(JSON.stringify(payload), "*")
}, 500);*/
}
}
Run Code Online (Sandbox Code Playgroud)