我正在使用带远程选项的模态对话框:
<a target="profile-banner" data-target="#edit-slide-dlg" href="/Banner/SlideEditModal/1/1"
data-toggle="modal" class="banner-slide-control">Edit</a>
Run Code Online (Sandbox Code Playgroud)
哪里:
<div id="edit-slide-dlg" class="modal fade" tabindex="-1"></div>
Run Code Online (Sandbox Code Playgroud)
另外,我正在监听使用event.target属性的shown.bs.modal事件:
$("body").on("shown.bs.modal", function (event) {
// do something with event.target
}
Run Code Online (Sandbox Code Playgroud)
我第一次打开对话框时没有触发此事件的原因.它只是第二次被解雇了.我试图浏览bootstrap脚本并找到此代码(请参阅我的评论):
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$element.find('.modal-dialog') // wait for modal to slide in
.one($.support.transition.end, function () {
that.$element.focus().trigger(e) //THIS LINE NEVER EXECUTED AT FIRST DIALOG OPENING
})
.emulateTransitionEnd(300) :
that.$element.focus().trigger(e)
Run Code Online (Sandbox Code Playgroud)
所以,我关闭转换作为一种解决方法,它使事件第一次被触发,但是,event.target是空字符串.第二次,event.target包含适当的对话框HTML.我的代码或引导程序有问题吗?
我找到了一种方法:
使用边距来控制对话位置margin: -335px 0 0 -280px;
设置宽度必须重置边距 width: 900px; margin: -250px 0 0 -450px;
设置高度使用max-height max-height: 800px;
基于
http://www.revillwebdesign.com/change-the-height-width-and-position-of-a-modal-in-twitter-bootstrap/
有一个更好的方法吗?使用这种或另一种方法,有没有办法只让对话框滑到top:0px并保持在那里直到被解雇?
使用我提到的第一个边距设置可以做到这一点但显然一旦浏览器调整大小,它就会被推出视图.
我尝试了很多来导入sql脚本,通过phpmyadmin在我托管的新站点中创建数据库和表.但是我得到了错误,
1044 - 用户'用户'@'localhost'拒绝访问数据库'db'
我试图直接创建一个示例数据库:创建数据库采样; 我收到相同的访问被拒绝错误.
我也无法向用户授予权限,我收到相同的访问被拒绝错误.
以下是show grants命令的输出,
show grants;
GRANT USAGE ON . TO 'someuser'@'localhost' IDENTIFIED BY PASSWORD 'somepw'
GRANT ALL PRIVILEGES ON someuser\_%.* TO 'someuser'@'localhost'
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.谢谢.
在 Node 18 发布fetch/FormData之前,我们可以这样做:
import FormData from 'form-data'
const form = new FormData();
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
Run Code Online (Sandbox Code Playgroud)
但是,使用全局 FormData 我无法再传递流 - “my_file”行的错误是:
“ReadStream”类型的参数不可分配给“string |”类型的参数 斑点'
我知道这仍然是实验性的,因此可能是一个错误,或者是否有其他方法可以做到这一点 - 除了将整个文件作为字符串读取之外......
我刚刚安装了PHP.
$ php -v
PHP 5.5.7 (cli) (built: Dec 11 2013 20:55:14)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
Run Code Online (Sandbox Code Playgroud)
我创建了一个名为test/一个名为的新目录,其中test.php包含以下内容:
<?php echo "hello world";
Run Code Online (Sandbox Code Playgroud)
当我启动一个PHP服务器并尝试在浏览器中加载它时,我收到"资源暂时不可用"错误:
johnny at arch in ~/Projects/test
$ php -S localhost:8080 .
PHP 5.5.7 Development Server started at Sun Jan 5 22:34:01 2014
Listening on http://localhost:8080
Document root is /home/johnny/Projects/test
Press Ctrl-C to quit.
[Sun Jan 5 22:34:18 2014] PHP Warning: Unknown: failed to open stream: …Run Code Online (Sandbox Code Playgroud) 在Visual Studio Code中,按command + p,有一个搜索输入,可以搜索和选择文件,
但在此列表中,还有一些其他项目,例如最近打开的(不知道它们将如何显示在那里的确切规则)
Visual Studio Code 中有没有办法在当前打开的选项卡之间进行搜索和选择?
我正在使用vuejs 2,我在使用Google身份验证时遇到问题.
我成功设置并使用vue进行了注销和用户配置文件功能:
export default {
data() {
return {
user: null
};
},
methods: {
getUserProfile() {
const profile = gapi.auth2.currentUser.get().getBasicProfile();
console.log(profile.getIdToken());
},
signOut() {
const auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('user signed out');
});
}
},
};
Run Code Online (Sandbox Code Playgroud)
我的主要问题是onSignIn(googleUser)来自的功能
<div class="g-signin2" data-onsuccess="onSignIn"></div>
在data-onsuccess="onSignIn"正在寻找VUE实例之外的js函数.我尝试onSignIn(googleUser)在我的HTML文件中添加该功能,如:
<script>
function onSignIn(googleUser) {
const auth2 = gapi.auth2.init();
if (auth2.isSignedIn.get()) {
const profile = auth2.currentUser.get().getBasicProfile();
console.log(profile.getName());
console.log(googleUser.getAuthResponse().id_token);
console.log(googleUser.getAuthResponse().uid);
console.log(auth2.currentUser.get().getId());
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
这按预期工作,但我想知道是否可以在我的vue文件而不是本机javascript方式中添加它,因为在此函数内部,我将调用其他vue方法.
或者有没有办法我可以onSignIn(googleUser)在vue中添加该功能,然后在Google Auth完成时调用它?
我们正在尝试在我们的产品中使用 Google OAuth。流程是让客户端从用户那里获得身份验证并将令牌发送到服务器。在服务器端,我需要验证令牌是否有效。目前,我使用 Google 提供的 OAuth2Sample 作为客户端。当我在服务器端验证发送的令牌时,出现以下异常:
com.google.api.client.auth.oauth2.TokenResponseException: 400 错误请求
{
“错误”:“invalid_grant”,
“error_description”:“格式错误的验证码。”
}在 com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105)
在 com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287) 在 com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest.execute(GoogleAuthorizationCodeTokenRequest.java:158)
这是服务器端的代码:
GoogleTokenResponse tokenResponse =
new GoogleAuthorizationCodeTokenRequest(
new NetHttpTransport(),
JacksonFactory.getDefaultInstance(),
"https://www.googleapis.com/oauth2/v4/token",
CLIENT_ID,
CLIENT_SECRET,
authToken, //Sent from the client
"") // specify an empty string if you do not have redirect URL
.execute();
Run Code Online (Sandbox Code Playgroud)
这是我在客户端获取访问令牌的方法:
private static final List<String> SCOPES = Arrays.asList(
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.googleapis.com/auth/userinfo.email");
//...
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
httpTransport, JSON_FACTORY,
clientSecrets, //Client ID and Client Secret
SCOPES).setDataStoreFactory(
dataStoreFactory).build();
LocalServerReceiver lsr = …Run Code Online (Sandbox Code Playgroud) 嘿,我已经构建了一个Nuxt应用程序,但我遇到了@nuxtjs/google-tag-manager包裹问题.发现如下.文档非常简单,我没有找到很多示例实现.在我,nuxt.config.js我有以下设置.
['@nuxtjs/google-tag-manager', {
id: process.env.GTM_ID,
layer: 'dataLayer',
pageTracking: true
}],
Run Code Online (Sandbox Code Playgroud)
..但遗憾的是我没有 在Google跟踪代码管理器中获取任何网页浏览量
有没有人对如何最好地实施GTM或者为他们起作用有什么想法或经验?
提前致谢
如何打印此图案?
$number = 5;
for ($i=1; $i <= $number ; $i++) {
for ($j=$i; $j >= 1;$j--){
echo "0";
}
echo "\n";
}
Run Code Online (Sandbox Code Playgroud)
印刷
0
00
000
0000
00000
Run Code Online (Sandbox Code Playgroud)
我试过这样,但我很困惑打印星号和零字符
0
00
000
0000
00000
Run Code Online (Sandbox Code Playgroud)
印刷
1 => 1
2 => 3
3 => 6
4 => 10
5 => 15
Run Code Online (Sandbox Code Playgroud) javascript ×3
php ×2
vue.js ×2
css ×1
database ×1
google-oauth ×1
html ×1
java ×1
jquery ×1
mysql ×1
node.js ×1
nuxt.js ×1
phpmyadmin ×1
typescript ×1
vuejs2 ×1