使用Vue(^ 2.0.0-rc.6) + Browserify,入口点是index.js:
import Vue from 'vue'
import App from './containers/App.vue'
new Vue({ // eslint-disable-line no-new
el: '#root',
render: (h) => h(App)
})
Run Code Online (Sandbox Code Playgroud)
App.vue:
<template>
<div id="root">
<hello></hello>
</div>
</template>
<script>
import Hello from '../components/Hello.vue'
export default {
components: {
Hello
}
}
</script>
<style>
body {
font-family: Helvetica, sans-serif;
}
</style>
Run Code Online (Sandbox Code Playgroud)
Hello.vue:
<template>
<div class="hello">
<h1>\{{ msg }}</h1>
</div>
</template>
<script>
export default {
data () {
return {
msg: 'Hello Vue!'
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
空白的白色屏幕,我错过了什么吗? …
我有Laravel应用程序,我每隔3秒检查一次用户心跳定期登录(演示目的,实际上是5分钟).对于每个节拍,我检查用户当前时间的最后一次活动是否也是5分钟.如果是,请将其注销.
这是我的代码:
$result = DB::table('db_user')->where('id_user','=',Session::get('id_user'))->where('last_activity','>=',"now() - interval 5 minute")->get();
if(!empty($result))
return Redirect::to('/logout');
else
return Response::json('still-alive');
Run Code Online (Sandbox Code Playgroud)
我的问题是,这不起作用.如果我将操作数更改为<=,它将在5分钟之前立即将我注销,如果操作数是>=,即使在5分钟后它也不会让我退出,有人可以解释原因吗?
-编辑-
感谢所有的答案,我通过修改我的代码解决了我的问题:
$result = DB::table('db_user')->where('id_user','=',Session::get('id_user'))->first();
if(!empty($result))
if(strtotime($result->last_activity) < strtotime("-5 minutes"))
return Redirect::to('/logout');
else
return Response::json('still-alive');
else
return Response::json('no-record');
Run Code Online (Sandbox Code Playgroud) 假设在domain(app.domain.com)中我设置了一个这样的Session:
Session::put('test', 'value');
Run Code Online (Sandbox Code Playgroud)
然后在不同的域(例如news.domain.com)中我想要检索该会话值.请注意,另一个域位于不同的服务器上,但仍然是相同的域名.
我的问题是,将Session::get('test')可在news.domain.com,如果我laravel配置文件设置为domain => '*.domain.com'?
我的browserify工作流程(从coffee到js,with browserify-shim和coffeeify)是这样的:
我有2个主要文件,app.coffee并_app.coffee分别对前端和后端.两个文件都位于resources/coffee/front和resources/coffee/back(分别).我正在尝试browserify在laravel elixir中包含任务,因此结果文件将打开public/js/app.js,public/js/_app.js并且可以在以后修改该build文件夹.
到目前为止,我试图通过browserify.js在elixir的node_modules ingredients文件夹中创建一个文件来扩展elixir .内容是:
var gulp = require('gulp');
var browserify = require('browserify');
var watchify = require('watchify');
var source = require('vinyl-source-stream');
var logger = require('../../../gulp/util/bundleLogger');
var errors = require('../../../gulp/util/handleErrors');
var config = require('../../../gulp/config').browserify;
elixir.extend('browserify', function(callback) {
var bundleQueue = config.bundleConfigs.length;
var browserifyThis = function(bundleConfig) {
var bundler = browserify({
cache: {},
packageCache: {},
fullPaths: true,
entries: …Run Code Online (Sandbox Code Playgroud) 好吧,这可能与编程有点不同.但是,如果让我说我有一个网站,其网址被重写
www.example.com?index.php?id=1&cat=category&title=My-Title
至
www.example.com/1/category/My-Title
是否可以被搜索引擎搜索为第二个Url?例如,如果我输入"类别我的标题",Google就会显示
www.example.com/1/ category/My-Title
代替
www.example.com?index.php?id=1&cat= category&title = My-Title
或者是否需要将任何必要的代码添加到htaccess文件中?
说我有localhost/public/admin重定向到localhost/public/user/login.
我如何获得admin价值user/login?
试图将图标放在ObjectListview中,这是我应该放置图标的代码片段:
objectListView1.SmallImageList = imageList1;
deleteColumn.IsEditable = true;
deleteColumn.ImageGetter = delegate
{
return 0;
};
deleteColumn.AspectGetter = delegate
{
return "Delete";
};
Run Code Online (Sandbox Code Playgroud)
imageList1已经有了一个图像,这段代码应该在"删除"旁边放一个图标,但它根本没有出现,通过食谱和谷歌查看,我仍然不知道.谁能帮我?
如果需要,这是完整的表单代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
objectListView1.AllowDrop = true;
objectListView1.DragEnter += new DragEventHandler(objectListView1_DragEnter);
objectListView1.DragDrop += new DragEventHandler(objectListView1_DragDrop);
objectListView1.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick;
objectListView1.CellEditStarting += deleteItems;
objectListView1.SmallImageList = imageList1;
deleteColumn.IsEditable = true; …Run Code Online (Sandbox Code Playgroud) 我是Laravel 4的新手,我正在尝试测试AJAX请求.
在我,script.js我有这个:
(function() {
$("#login-submit").click(function(e) {
e.preventDefault();
return $.ajax({
type: "POST",
url: "laravel/ajax/login", //i put my public in "localhost/laravel/public/"
cache: false,
data: 'email:' + $("#email").val(),
success: function(data) {
return alert(data);
},
error: function(response) {
return alert("ERROR:" + response.responseText);
}
});
});
}).call(this);
Run Code Online (Sandbox Code Playgroud)
从这个html文件调用:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<form>
<label for="email">Email: </label>
<input type="text" id="email" />
<label for="email">Password: </label>
<input type="password" id="password" />
<button id="login-submit">Log In</button>
</form>
<script type="text/javascript" src="assets/js/jquery/jquery.custom.js"></script>
<script type="text/javascript" src="assets/js/script.js"></script>
</body>
</html> …Run Code Online (Sandbox Code Playgroud) 基本上我正在尝试使用这个ajax制作一个弹出窗口:
$.ajax({
type: 'GET'
url: 'news/read'
dataType: 'json'
cache: false
timeout: 10000
}).done (msg) ->
$("article#pop-read").empty().html msg.view
processing = false
window.history.pushState
path: msg.url
, "", msg.url
false
Run Code Online (Sandbox Code Playgroud)
我正在返回一个视图值,它的网址是:
$data = json_encode(array(
'view' => View::make('layouts.read'),
'url' => 'news/read/2013/11/24/test-title-seperate-with-dash'
));
return $data;
Run Code Online (Sandbox Code Playgroud)
这一切都很好,除了我无法从laravel获取视图值(它Object object在javascript中返回).但是如果我直接写它就会很好地返回return View::make('layouts.read').这是为什么?
另外(不必回答,不是主要问题),我使用时浏览器上的后退按钮不起作用pushState,这是一个错误吗?
使用https://github.com/matfish2/vue-tables-2,使用Vue版本2,我似乎无法绑定JSX上的click事件(在templates-> edit上):
var tableColumns = ['name', 'stock', 'sku', 'price', 'created_at']
var options = {
compileTemplates: true,
highlightMatches: true,
pagination: {
dropdown: true,
chunk: 10
},
filterByColumn: true,
texts: {
filter: 'Search:'
},
datepickerOptions: {
showDropdowns: true
},
templates: {
edit: function (h, row) {
return <button v-on:click={this.showItem(row.id)} class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-edit"></i></button>
},
delete: function (h, row) {
return <a href="javascript:void(0);" class="btn btn-danger btn-sm"><i class="glyphicon glyphicon-erase"></i></a>
}
}
}
export default {
name: 'ItemList',
data: function () { …Run Code Online (Sandbox Code Playgroud) php ×4
javascript ×3
laravel-4 ×3
ajax ×2
laravel ×2
vue.js ×2
.htaccess ×1
babel ×1
browserify ×1
c# ×1
coffeescript ×1
cross-domain ×1
icons ×1
jquery ×1
json ×1
jsx ×1
laravel-5 ×1
node.js ×1
seo ×1
session ×1
sql ×1
symfony ×1
vue-tables-2 ×1
vuejs2 ×1