查看Vuetify示例代码v-toolbar
的目的是v-slot:activator="{ on }"
什么?例如:
<template v-slot:activator="{ on }">
<v-toolbar-title v-on="on">
<span>All</span>
<v-icon dark>arrow_drop_down</v-icon>
</v-toolbar-title>
</template>
<script>
export default {
data: () => ({
items: [
'All', 'Family', 'Friends', 'Coworkers'
]
})
}
</script>
Run Code Online (Sandbox Code Playgroud)
据我所知,on
它在任何地方都不是定义的变量,因此我看不到它是如何工作的。当我在项目中尝试使用Internet Explorer时,Internet Explorer会引发错误<template v-slot:activator="{ on }">
,但是如果将其删除,则会呈现页面。
我正在制作一个多个玩家应该能够一次玩的游戏.这是一个2D
游戏,所有角色应该能够看到对方在屏幕上移动.就像游戏一样,现在所有的设备都只是发布并将其他人提取coordinates
到服务器.这是通过运行到线程来完成的:
public void StartCoordinatorFetcherThread(final Sprite Object)
{
Thread CoordinateStarter = new Thread()
{
public void run()
{
while(true)
{
Object.testing = Object.InternetObject.GetMessages();
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
CoordinateStarter.start();
}
public void StartCoordinatorPosterThread(final Sprite Object)
{
Thread CoordinatePoster = new Thread()
{
public void run()
{
while(true)
{
Object.InternetObject.PostCoordinates(Object.x,Object.y);
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
CoordinatePoster.start();
}
Run Code Online (Sandbox Code Playgroud)
无论如何,我希望角色能够更顺利地移动,因为它可以"laggy"
像这样做.有人知道如何实现这个目标吗?
也许我应该有一种坐标堆栈,它只是一直推动坐标,然后在游戏运行时弹出值?
任何帮助将受到高度赞赏. …
我遇到的问题是我同时使用Camera(低于Lollipop设备)和CameraManager类(Lollipop及以上设备).
运行低于Lollipop的设备崩溃,我相信这是因为
import android.hardware.camera2.CameraManager;
Run Code Online (Sandbox Code Playgroud)
部分.我怎么能做到这一点
package com.example.DeviceCommands;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.Camera;
import android.hardware.Camera.AutoFocusCallback;
import android.hardware.Camera.Parameters;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraManager;
import android.os.Build;
public class FlashController
{
Context _context;
boolean _is_supported = false;
boolean _enabled = false;
Object _camera;
@TargetApi(Build.VERSION_CODES.L) public FlashController(Context context)
{
if (context.getPackageManager().hasSystemFeature(PackageManager
.FEATURE_CAMERA_FLASH))
{
_context = context;
_is_supported = true;
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP)
{
Camera camera = Camera.open();
if (camera == null)
{
_is_supported = false;
System.out.println("NOT SUPPORTED!");
return;
}
_camera = camera; …
Run Code Online (Sandbox Code Playgroud) 我正在使用 Bootstrap 4 制作登录页面。使用 Bootstrap 的容器的最大宽度似乎是 1140px?我的显示器现在是 1920px。我是否必须将 bootstrap 的值覆盖为 1920px 才能使其支持该尺寸的显示器?
这是我使用的代码,我想将登录表单的内容居中(代码仅用于测试以将内容居中):
<body>
<div class="container h-100 d-flex justify-content-center">
<div class="jumbotron my-auto">
<h1 class="display-3">Hello, world!</h1>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
或者甚至对于更大的显示器,我是否应该将尺寸增加到疯狂的高(如 999999px)以支持它们?
感谢您的任何反馈!
我已经在laravel环境中使用package.json(npm)安装了babel-polyfill。我正在使用vuetify生成表。但是,当在IE11中打开呈现表格的页面时,表格会显示出来,但是所有列都消失了(所有列都合并为一个列),并且我无法与数据表进行交互(我有行点击事件在Chrome中可以正常运行, Firefox和Edge)。我需要其他的polyfill包装吗?
Package.json:
"devDependencies": {
...
"babel-polyfill": "^6.26.0",
...
}
Run Code Online (Sandbox Code Playgroud)
app.js:
import babelPolyfill from 'babel-polyfill';
import Vuetify from 'vuetify'
window.Vue = require('vue');
Vue.use(vueResource);
Vue.use(Vuetify);
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
编辑:原来这是一个错误。它似乎已在1.5.5版中修复。
我从一个线程调用了以下函数:
Thread Move = new Thread(){
public void run()
{
while(ButtonDown){
UpdateValues();
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
Move.start();
Run Code Online (Sandbox Code Playgroud)
当while循环中断时,Android会删除线程,还是必须以某种方式删除它?
我遇到的问题是我使用ImageReader除了有一个SurfaceView用于显示相机的输出.我已经添加了SurfaceView本身和ImageReader的表面(并添加了ImageReader监听器以便在新图像上接收事件):
preview.addTarget(_surfaces.get(1)); //ImageReader surface
preview.addTarget(_surfaces.get(0)); //SurfaceView of the layout
Run Code Online (Sandbox Code Playgroud)
但是,如果我删除ImageReader,应用程序工作正常(没有滞后于相机).但是一旦ImageReader表面被添加,相机就会滞后很多.任何人都有任何想法,以使相机运行更顺畅?ImageReader的创建方式如下:
reader = ImageReader.newInstance(640, 480, ImageFormat.JPEG, 1);
Run Code Online (Sandbox Code Playgroud)
我猜测滞后可能是因为图像必须在布局的SurfaceView和ImageReader本身上呈现两次(?)
如何在 torrent 文件上生成 torrent 哈希信息。
我一直在看这个例子:如何使用 Java 计算 torrent 的哈希值,并尝试将其转换为 C++。这是我到目前为止的代码:
void At::ReadTorrent::TorrentParser::create_hash(std::string torrentstub)
{
std::string info;
int counter = 0;
while(info.find("4:info") == -1)
{
info.push_back(torrentstub[counter]);
counter++;
}
unsigned char array[torrentstub.size()];
int test = 0;
for(int data; (data = torrentstub[counter]) > -1;)
{
array[test++] = data;
counter++;
}
std::cout << array << std::endl;
//SHA-1 some value here to generate the hash.
}
Run Code Online (Sandbox Code Playgroud)
参数torrentstub
是以字符串表示的 torrent 文件。据我了解,我必须获得之后的信息4:info
。我认为这工作正常,例如:
d6:lengthi2847431620e4:name8:filename12:piece lengthi1143252e6:pieces50264
Run Code Online (Sandbox Code Playgroud)
之后只有我无法读取的信息,我猜这是一些二进制数据?
所以我的问题实际上可以归结为:应该对 后面的所有内容进行哈希处理的信息4:info
,以及我应该在哪里停止收集哈希数据?
我创建了一些迁移文件,这些文件创建了“users”和“user_info”表。运行php artisan migrate
创建了表并将它们添加到数据库中的迁移表中。
然后我需要创建一个新列并向 user_info 表添加一些新行。因此,我创建了一个与用于创建“user_info”表的第一个迁移文件同名的新迁移文件。由于 Laravel 向文件添加了时间戳,我认为这不会造成任何问题。但是,在新的迁移文件中,我使用了与第一个迁移文件相同的类名,进行了我想要的更改并最终php artisan migrate
再次运行。
这似乎产生了问题,因为我收到一条错误消息,指出类名已被使用。所以我将迁移文件名更改为 user_info2 并使用类名 UserInfo2 并再次尝试。这次它起作用了,并且批处理在数据库的迁移表中增加到了 2。
但是 Laravel 如何知道迁移文件实际上与第一个 user_info 迁移文件相关,因为我更改了文件名和类名?我认为它们必须具有相同的名称才能使 Laravel 控制“批处理值”。
谢谢你的帮助!
当用户点击名为winners的表时,我遇到了jquery片段的问题.代码
$('#winners tr').click(function() {
alert(223);
});
Run Code Online (Sandbox Code Playgroud)
只有在我在此代码段之前发出警报时才会触发:
alert(1);
$('#winners tr').click(function() {
alert(223);
});
Run Code Online (Sandbox Code Playgroud)
整个代码如下所示.问题是底部的代码片段.
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.7.1");
function listen(last_modified, etag) {
$.ajax({
'beforeSend': function(xhr) {
xhr.setRequestHeader("If-None-Match", etag);
xhr.setRequestHeader("If-Modified-Since", last_modified);
},
url: '/test/sub',
dataType: 'text',
type: 'get',
cache: 'false',
success: function(data, textStatus, xhr) {
/*REMOVED CODE*/
});
/* Start the next long poll. */
listen(last_modified, etag);
},
error: function(xhr, textStatus, errorThrown)
{
//$('#data').prepend(textStatus + ' | ' + errorThrown);
}
});
};
google.setOnLoadCallback(function() {
/* Start the …
Run Code Online (Sandbox Code Playgroud) android ×4
laravel ×2
vue.js ×2
vuetify.js ×2
bittorrent ×1
bootstrap-4 ×1
c++ ×1
info-hash ×1
java ×1
javascript ×1
jquery ×1
multiplayer ×1
vuejs2 ×1