我真的不知道问题在哪里说实话.
可能是Dropzone,Laravel(5.4),......所以我真的希望即使是一个想法也可以帮助我解决这个问题.
当我上传文件时,我没有得到任何js问题,但是Laravel抛出了我的错误(对于每个文件):
调用未定义的方法Symfony\Component\HttpFoundation\File\UploadedFile :: store()
这是我的后端代码(在portfolioStore方法中设置了Error):
<?php
namespace App\Http\Controllers;
use App\Http\Requests\UploadPortfolioPhotoRequest; use App\PortfolioPhoto; use DebugBar\DebugBar; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage;
class AdminController extends Controller {
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('admin.home');
}
public function portfolioIndex()
{
$photos = PortfolioPhoto::all();
return view ('admin.portfolio.index')->with('photos', $photos);
}
public function portfolioStore(UploadPortfolioPhotoRequest $request)
{
foreach ($request->files …Run Code Online (Sandbox Code Playgroud) 我正在试图找到一种方法来构建一个能够注入插件的新工作框架.我们的想法是异步加载每个文件.
以下是我喜欢配置插件的方法:
<script id="target_root" src="assets/js/target/target.js" async="true"></script>
<script>
var target = target || {};
target.cmd = target.cmd || [];
target.cmd.push(function () {
target.loadPlugins([
{"name": "root", "src": "assets/js/target/target.root.js"},
{"name": "krux", "src": "assets/js/target/target.krux.js"}
]).then(
target.init([
{
'plugin': 'root',
'opts': {
'foo': 'bar'
}
},
{
'plugin': 'krux',
'opts': {
'foo': 'bar'
}
}
])
)
});
</script>
Run Code Online (Sandbox Code Playgroud)
当我使用内联函数(在DOM中)时,我想到使用一个命令队列,在加载时会调用所有推送的函数(有点像DFP的googletag cmd).
如前所述,每个插件都将异步加载,因此每个插件的初始化只应在所有插件加载时启动(因此then()函数).
在这里你有我的脚本:
var target = (function(root, w, d, c) {
var queueIndex = 0,
amountPluginsLoaded = 0,
pluginsLoaded = [];
root.cmd = {
'queue': …Run Code Online (Sandbox Code Playgroud) 我刚刚读到有关通过云设计 Google 地图样式的可能性。这使得设计它们的样式变得更加容易,而无需实际重新部署应用程序。
以下是我找到的 Android 和 IOS 的 2 个文档:
对于 Android,这似乎是一个简单的解决方案,只需将片段添加到 xml 文件即可。不幸的是,对于 IOS,您需要在创建 Google 地图时对其进行初始化。
安卓示例
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="map_id">YOUR_MAP_ID</string>
</resources>
Run Code Online (Sandbox Code Playgroud)
示例 IOS
let camera = GMSCameraPosition(latitude: 47.0169, longitude: -122.336471, zoom: 12)
let mapID = GMSMapID(identifier: "<YOUR MAP ID>")
let mapView = GMSMapView(frame: .zero, mapID: mapID, camera: camera)
self.view = mapView
Run Code Online (Sandbox Code Playgroud)
这与 flutter 插件相结合,看起来开销很大。是否有更简单的方法来添加 MapId?现在我正在使用https://pub.dev/packages/google_maps_flutter插件
出于安全原因,我们创建用户并向他们发送临时生成的密码.在第一次登录时,用户应该在继续导航受保护的页面之前更改其密码.
我正在使用运行护照本地模块的快递/节点网站.注册,登录用户所有工作.但是,我有点迷失在用户首次登录时更改密码的最佳做法.
我的想法是做以下事情:
/* POST login page. */
router.post('/login', function(req, res, next) {
passport.authenticate('local', { successRedirect: '/dashboard/users',
failureRedirect: 'pages/login'}, function(err, user, info) {
if(err) {
console.log('')
return res.render('pages/login', {title: 'Login', error: err.message});
}
if(!user) {
return res.render('pages/login', {title: 'Login', error: info.message});
}
return req.logIn(user, function(err) {
if(err) {
return res.render('pages/login', {title: 'Login', error: err.message});
} else if (user.firstLogin) {
return res.redirect('/change-password'); // <- First login
} else {
return res.redirect('/dashboard/users');
}
});
})(req, res, next);
}); …Run Code Online (Sandbox Code Playgroud) 我有一个页面分为多个部分。现在,在滚动时,我尝试使用导航项下边框的宽度来显示进度(视图中有多少部分)。在下面您将找到我如何实现它的示例。
现在,如您所见,如果某个部分高于视口,则 intersectionRatio 将永远不会达到 1(这反过来也不会绘制全宽边框)。我可以使用任何选项或替代方案来真正实现全宽度吗?
(function() {
var sections = [],
links = {},
thresholdSet = [[]],
observerOptions = {
root: null,
rootMargin: "0px",
threshold: _buildThresholdList()
};
function _init() {
if (!'IntersectionObserver' in window) {
return;
}
sections = document.getElementsByClassName('section');
for(var i = 0; i < sections.length; i++) {
var observer = new IntersectionObserver(_intersectionCallback, observerOptions),
section = sections[i],
link = document.getElementById('js-' + section.id);
links[section.id] = {
node: link,
initialWidth: link.offsetWidth
};
observer.observe(section);
}
}
function _buildThresholdList() {
for(var i = …Run Code Online (Sandbox Code Playgroud)我知道你可能想知道自制的条形图?为什么不是现有的图书馆?好吧,我讨厌使用20000行代码的文件,而只需要500行代码.
哦,这很有趣:)主要目标是我将使用这个脚本为我将使用Phonegap制作的应用程序.所以尺寸越小越好.
我已经能够绘制条形图,确保它们具有相等的宽度并且其高度取决于父容器的高度.正如您在下面的代码中看到的,我还为选项添加了字体大小.因为某些图表将扩展到300px的高度(例如,使用默认的16px).有些只有50像素,字体大小为12或更小.因此我将ChartContainer栏缩小了3 x fontsizes(+ rest)以确保顶部(金额)和底部(图例+标题)有足够的空间
现在我不完全确定如何添加和居中金额.我尝试搜索现有的图表库以检查它是如何呈现的,不幸的是它们都使用了画布或SVG容器.有什么建议?
/* dataset
------------------
add legends
add result / amount
add bottom-border: 8px extra to both sides?
add chart name
*/
(function ($) {
var methods = {
init : function(options) {
return this.each(function() {
var $this = $(this),
dataset = options.dataset,
fontSize = options.fontSize,
widthOfContainer = $this.width(),
heightOfContainer = $this.height() - (3 * (fontSize + 4)), // make room for title (bottom), legend (bottom), amounts (top)
widthOfBar = parseInt(widthOfContainer / options.dataset.length) …Run Code Online (Sandbox Code Playgroud)javascript ×3
android ×1
asynchronous ×1
css ×1
dropzone.js ×1
express ×1
flutter ×1
ios ×1
jquery ×1
laravel ×1
laravel-5.4 ×1
passport.js ×1
php ×1
plugins ×1