我正在用ES6重新编写我的电子应用程序,使用Laravel Mix编译应用程序JS和SASS.现在,主进程可以很好地加载渲染过程.一旦发生这种情况,我的app.js就会加载,这就是我遇到问题的地方.所以我这样做:
import { remote } from 'electron';
Run Code Online (Sandbox Code Playgroud)
这导致控制台中出现此错误:
Uncaught Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
Run Code Online (Sandbox Code Playgroud)
现在我已经尝试重新安装电子,即使电子在主要过程开始时起作用.该行在编译的js中引用了这个:
/* WEBPACK VAR INJECTION */(function(__dirname) {var fs = __webpack_require__(8)
var path = __webpack_require__(9)
var pathFile = path.join(__dirname, 'path.txt')
if (fs.existsSync(pathFile)) {
module.exports = path.join(__dirname, fs.readFileSync(pathFile, 'utf-8'))
} else {
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
}
Run Code Online (Sandbox Code Playgroud)
我不确定发生了什么,任何建议或信息都会有很大的帮助!
谢谢
编辑:我试过运行它--verbose:
/Library/Caches/com.apple.xbs/Sources/AppleGVA/AppleGVA-10.1.16/Sources/Slices/Driver/AVD_loader.cpp: failed to get a service for …Run Code Online (Sandbox Code Playgroud) 我有一个vue组件,显示一个表单,其中填充了要编辑的选定项目中的项目.现在我不想使用第二种形式来创建新项目.目前我使用v-model自动填充和更新项目,这显然更新了对象.我不能在这样使用条件运算符吗?
<form @submit.prevent>
<div class="field">
<label class="label">Job Title</label>
<p class="control">
<input type="text" class="input" placeholder="Job title" v-model="experiences[editIndex].title ? experiences[editIndex].title : ''" />
</p>
</div>
</form>
Run Code Online (Sandbox Code Playgroud) 我正在构建一个循环遍历3个不同背景的页面,每750毫秒更换一次.要做到这一点,我将使用相关的背景图像向主体添加一个类,并使用JS进行更改.对于第一个循环,它们会闪烁,因为图像必须加载,所以它不会立即出现.因此有什么方法可以用来预加载图像吗?
CSS:
&.backgrounds{
background-position: center bottom;
background-repeat: no-repeat;
background-size: 130%;
&.freddy{
background-image: url(/img/illustrations/snapchat/snapchat_holding_page_freddy.jpg);
}
&.irene{
background-image: url(/img/illustrations/snapchat/snapchat_holding_page_irene.jpg);
}
&.joe{
background-image: url(/img/illustrations/snapchat/snapchat_holding_page_joe.jpg);
}
}
Run Code Online (Sandbox Code Playgroud)
JS:
setInterval(function() {
if ( $('.backgrounds').hasClass('freddy') ){
$('.backgrounds').removeClass('freddy').addClass('irene');
} else if ( $('.backgrounds').hasClass('irene') ){
$('.backgrounds').removeClass('irene').addClass('joe');
} else if ( $('.backgrounds').hasClass('joe') ){
$('.backgrounds').removeClass('joe').addClass('freddy');
}
}, 750);
Run Code Online (Sandbox Code Playgroud) 所以我开始将我的 sass 写到 BEM 公约中。我已经使用sass-lint 配置生成器来创建我的配置,并且只将class-name-format's编辑为- convention:,strictbem但是我仍然遇到一些问题。
也许我误解了 BEM?
错误:
[sass-lint] 类 '
.bus__tyre--front' 应该以 BEM(块元素修饰符)格式(class-name-format)编写<element class="bus__tyre--front">
萨斯:
.bus {
position: relative;
&__tyre {
position: absolute;
&--front {
bottom: -22px;
right: 3%;
width: 17%;
}
}
}
Run Code Online (Sandbox Code Playgroud)
sass-lint.yml:
# sass-lint config generated by make-sass-lint-config v0.1.2
#
# The following scss-lint Linters are not yet supported by sass-lint:
# DisableLinterReason, ElsePlacement, PropertyCount, SelectorDepth
# SpaceAroundOperator, TrailingWhitespace, UnnecessaryParentReference, Compass::*
#
# The …Run Code Online (Sandbox Code Playgroud) 我正在使用Vue与单个文件组件和Webpack来编译所有内容.我安装了vue,vue-loader和vue-template-compiler(作为开发依赖和对等依赖),但是vue-loader返回以下错误.
ERROR in ./resources/assets/js/components/Modal.vue
Module build failed: Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
我还确保vue和vue-template-compiler的版本在另一篇文章中提到的关于不同问题的对齐.我不确定我在哪里错了.
这是我的webpack配置:
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const WebpackNotifierPlugin = require('webpack-notifier');
const { VueLoaderPlugin } = require('vue-loader');
const path = require('path');
require('babel-polyfill');
const inProduction = (process.env.NODE_ENV === 'production');
module.exports = {
entry: {
vendor: [
'./index.js',
'babel-polyfill',
],
main: './resources/assets/js/main.js',
banner: './resources/assets/js/banner.js',
video: './resources/assets/js/video.js',
newsSlider: './resources/assets/js/news-slider.js',
},
output: {
path: …Run Code Online (Sandbox Code Playgroud) 我有一个消息空间,响应字段很好,底部很小.当用户点击时,它会展开.然而,当我专注时,如果我然后单击我的按钮,它会失去焦点 - 正如预期的那样,但是按钮没有被触发,我必须再次点击它.我该如何最好地解决这个问题?
.wrap {
align-items: center;
display: flex;
justify-content: flex-end;
}
textarea {
height: 40px;
width: 100%;
transition: height .2s ease;
}
textarea:focus {
height: 150px;
}
.fancy-button {
background-color: red;
cursor: pointer;
margin-left: 20px;
height: 30px;
width: 30px;
}Run Code Online (Sandbox Code Playgroud)
<div class="wrap">
<textarea></textarea>
<div class="fancy-button" onclick="alert('click');">
</div>Run Code Online (Sandbox Code Playgroud)
我已经更改了我的policy.xml以允许更大的最大图像大小.在命令行中运行脚本时:
$ php image.php
64000
Run Code Online (Sandbox Code Playgroud)
但是当我在浏览器中加载它时:
16000
Run Code Online (Sandbox Code Playgroud)
该脚本只包含:
<?php echo Imagick::getResourceLimit(9);
Run Code Online (Sandbox Code Playgroud)
如何将相同的策略应用于所服务的脚本?
编辑:回答多条评论:
所以策略文件/etc/ImageMagick-6/policy.xml位于find /usr /opt / -name policy.xml.服务器是nginx,它是一个DigitalOcean Droplet,所以我有完全控制权.
我已经尝试在实例化Imagick和之后设置资源限制,两者都返回相同的16000限制.
在命令行中运行文件和浏览器都只在服务器上完成.
这是我的调整后的政策文件,我已经把它全部搞砸了,因为它们中的任何一个都造成了限制.图像的最大文件大小为2GB,300dpi时大约为32000px(用于打印):
<policy domain="resource" name="memory" value="1GB"/>
<policy domain="resource" name="map" value="1GB"/>
<policy domain="resource" name="width" value="64KB"/>
<policy domain="resource" name="height" value="64KB"/>
<policy domain="resource" name="area" value="1GB"/>
<policy domain="resource" name="disk" value="2GB"/>
Run Code Online (Sandbox Code Playgroud) 我有一个客户,允许客户上传大文件以进行打印操作。该网站使用 Imagick 来处理图像,但是,当尝试设置最大宽度和高度时,它不会高于 16000。例如:
// This sets the max width to 20000px
php > Imagick::setResourceLimit(9, 20000);
php > echo $image->getResourceLimit(9);
16000
php > Imagick::setResourceLimit(9, 15000);
php > echo $image->getResourceLimit(9);
15000
Run Code Online (Sandbox Code Playgroud)
这是库的限制还是我需要配置其他内容?
好的,对于python来说还是很新的东西,ans刚开始在我的Pi上使用PyQT为我拥有的某些代码制作GUI。但是,该窗口会瞬间打开,然后关闭到一个小窗口。谁能告诉我我要去哪里错了?
import sys
from PyQt4 import QtGui, QtCore
class mainUI(QtGui.QWidget):
def __init__(self):
super(mainUI, self).__init__()
self.initUI()
def initUI(self):
MainWindow = QtGui.QWidget()
MainWindow.showFullScreen()
MainWindow.setWindowTitle('TimeBot')
MainWindow.show()
qbtn = QtGui.QPushButton('Quit')
qbtn.clicked.connect(QtCore.QCoreApplication.quit)
qbtn.move(5,5)
qbtn.show()
self.show()
def main():
app = QtGui.QApplication(sys.argv)
window = mainUI()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
Run Code Online (Sandbox Code Playgroud) 我在 Laravel 本地保存文件,但是在获取正确的 URL 和访问文件时遇到问题。
我已经与 Artisan 设置了符号链接:
php artisan storage:link
Run Code Online (Sandbox Code Playgroud)
保存时,我添加public/了名称,因此文件被放置在/storage/app/public/目录中,这是有效的。
if ($request->hasFile('files')) {
$files = array();
foreach ($request->file('files') as $file) {
if ($file->isValid()) {
$name = time() . str_random(5) . '.' . $file->getClientOriginalExtension();
Storage::disk('public')->put($name, $file);
$files[] = $name;
}
}
if (count($files) > 0) {
$response->assets = json_encode($files);
}
}
Run Code Online (Sandbox Code Playgroud)
该名称存储在数据库中
["1524042807kdvws.pdf"]
Run Code Online (Sandbox Code Playgroud)
然后,资产将通过我的 Vue API 作为 JSON 对象的一部分返回
if (count($response->assets) > 0) {
$assets = array();
foreach (json_decode($response->assets, true) as $asset) {
$assets[] = …Run Code Online (Sandbox Code Playgroud) 我正在使用Laravel Query Builder获取一组行,按2列排序,ticket_id然后id(之前created_at).但是,结果按顺序ticket_id(正确)排序,但id(或created_at)次要顺序不正确.我是否接近这种错误,误解的顺序?
这是我的查询:
$responses = Response::where('status', '=', 'closed');
->select('id', 'ticket_id', 'created_at', 'author_id')
->orderBy('ticket_id', 'id')
->get();
Run Code Online (Sandbox Code Playgroud)
反过来,返回:
0 => array:3 [
"ticket_id" => 14
"id" => 71
"time" => "2018-05-25 08:55:03"
]
1 => array:3 [
"ticket_id" => 14
"id" => 75
"time" => "2018-05-25 12:48:45"
]
2 => array:3 [
"ticket_id" => 14
"id" => 72
"time" => "2018-05-25 08:55:53"
]
3 => array:3 [
"ticket_id" => …Run Code Online (Sandbox Code Playgroud) php ×4
javascript ×3
css ×2
imagemagick ×2
imagick ×2
laravel ×2
sass ×2
vuejs2 ×2
bem ×1
css3 ×1
ecmascript-6 ×1
electron ×1
elixir-mix ×1
html ×1
laravel-mix ×1
mysql ×1
nginx ×1
pyqt4 ×1
python ×1
python-3.x ×1
sass-lint ×1
vue.js ×1
webpack ×1