当涉及到js时,我几乎是一个新手,所以如果我遗漏了一些非常简单的话,我很抱歉.
基本上,我已经做了一些关于使用history.pustate和popstate的研究,我已经做了,所以通过使用查询字符串添加到url(?v=images)或(?v=profile)...(v意思是"视图")的末尾这个:
var url = "?v=profile"
var stateObj = { path: url };
history.pushState(stateObj, "page 2", url);
Run Code Online (Sandbox Code Playgroud)
我想这样做,所以我可以将内容加载到div但不重新加载我使用该.load()功能完成的页面.
然后我使用了这段代码:
$(window).bind('popstate', function(event) {
var state = event.originalEvent.state;
Run Code Online (Sandbox Code Playgroud)
在$(document).ready()部分和后来尝试只是<script>标签,但都没有工作.
我不知道如何制作它,所以当我使用后退按钮时内容会发生变化,或者至少让它变为可以触发我自己的功能; 我假设它与状态对象有关?!我似乎无法在网上找到任何清楚解释过程的内容.
如果有人可以帮助我,那将是惊人的,并提前感谢任何人!
我没有使用资源控制器。
路线:
Route::delete('/deleteTag/{tag}','Controller2@deleteTag');
Run Code Online (Sandbox Code Playgroud)
控制器功能:
public function deleteTag(Tag $tag){
$Tag = Tag::where('id', $tag->id)->get()->first();
$Tag->delete();
return redirect()->action('Controller2@main');
}
Run Code Online (Sandbox Code Playgroud)
电话:
<form method="delete" action="http://***/public/deleteTag/{{$tag->id}}">
{!! Form::token() !!}
<button type="submit">delete</button>
</form>
Run Code Online (Sandbox Code Playgroud)
程序返回MethodNotAllowedHttpException。
谢谢。
是否可以查询将来x天增量的所有日期?
即
SELECT *
FROM bookings
WHERE date >= CURDATE()
AND
(
date = CURDATE() + INTERVAL 6 DAY
OR date = CURDATE() + INTERVAL 12 DAY
OR date = CURDATE() + INTERVAL 18 DAY
etc.
)
Run Code Online (Sandbox Code Playgroud) 我在关系中有条件,如果用户登录将返回关系,如果不是,我希望它返回空关系.这就是我想要的:
public function dummy()
{
return (auth()->user()) ? $this->hasOne(blah::class) : emptyrelationship();
}
Run Code Online (Sandbox Code Playgroud) WebSocket 允许双向通信:服务器可以向浏览器发送消息,浏览器 - 客户端 - 可以通过相同的连接进行响应。
我正在 Laravel 6 中使用以下方法实现聊天应用程序:
我已经知道服务器触发事件并且客户端侦听这些事件如下。
composer require beyondcode/laravel-websockets
config/broadcasting.php. 'pusher' => [
'driver' => 'pusher',
'key' => xxx,
'secret' => xxx,
'app_id' => xxx,
'options' => [
'cluster' => xxx,
'encrypted' => true,
'useTLS' => true,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'https',
],
],
]
Run Code Online (Sandbox Code Playgroud)
config/websockets.php'apps' => [
[
'id' => xxx,
'name' …Run Code Online (Sandbox Code Playgroud) 这只是一个快速的(我希望).
我最近一直在使用jquery ui对话框页面来查看在对话框http://jqueryui.com/dialog/#modal-form中使用表单,我注意到一些我之前没见过的代码:
var allFields = $([]).add(#input1).add(input2).add(input3)....
Run Code Online (Sandbox Code Playgroud)
我只是想知道$([])是什么意思?
起初我以为这是一种在jquery中创建数组的方法,但是当我尝试时:
allFields.add(input4)
Run Code Online (Sandbox Code Playgroud)
声明变量之后没有添加任何其他内容?!?
任何帮助将不胜感激!:)我试过谷歌搜索,但是,我没有太多运气.
当谈到超越MySQL的基础时,我并不精彩,但是,我正在尝试优化查询:
SELECT DATE_FORMAT(t.completed, '%H') AS hour, t.orderId, t.completed as stamp,
t.deadline as deadline, t.completedBy as user, p.largeFormat as largeFormat
FROM tasks t
JOIN orders o ON o.id=t.orderId
JOIN products p ON p.id=o.productId
WHERE DATE(t.completed) = '2013-09-11'
AND t.type = 7
AND t.completedBy IN ('user1', 'user2')
AND t.suspended = '0'
AND o.shanleys = 0
LIMIT 0,100
+----+-------------+-------+--------+----------------------------+-----------+---------+-----------------+-------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+--------+----------------------------+-----------+---------+-----------------+-------+-------------+
| 1 …Run Code Online (Sandbox Code Playgroud) $order_detail = Order::where([['user_id', $user->id], ['updated_at', '>', $updated_at]])
->with([
'currency' => function ($query) {
$query->select('currency_code', 'currency_symbol', 'ex_rate_with_base');
},
'orderList' => function ($query) {
$query->select('id', 'order_id', 'product_code', 'qty',
DB::raw('(unit_price*orders.ex_rate_with_base) as unit_price_new'), 'status');
},
])->get();
Run Code Online (Sandbox Code Playgroud)
请帮忙,
如何ex_rate_with_base在子查询中使用订单表中的属性。我不想使用DB查询。请雄辩地解决它。
I started using Vue using the Vue CLI template. In that template you create a file called 'vue.config.js' to define some settings. More to find here: https://cli.vuejs.org/guide/css.html#css-modules
I had a settings for an global css/sass file so all my components could access the variables (the file only contains vars).
vue.config.js:
module.exports = {
// So we can use the template syntages in vue components (correct me if am wrong)
runtimeCompiler: true,
// CSS settings
css: {
loaderOptions: {
sass: { …Run Code Online (Sandbox Code Playgroud)