运行brew tap会给我一个已注册的水龙头列表
homebrew/cask
homebrew/core
sethdeckard/proj
Run Code Online (Sandbox Code Playgroud)
我如何卸载/删除/删除其中之一?
我使用nklayman/vue-cli-plugin-electron-builder创建了一个使用 Vue/Vuex 准备的电子应用程序。它附带文件main.js,background.js包括 Vue 组件起点。但我无法让事件发挥作用。我在下面的尝试Uncaught ReferenceError: __dirname is not defined在渲染时产生(编译很好)。
组件:Splash.vue
<template>
<div @click="open">open</div>
</template>
<script>
const { ipcMain } = require('electron')
export default {
methods: {
open()
{
ipcMain.on('my-open-event', (event, arg) => {
console.log(event, arg)
})
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
背景.js
import { app, protocol, BrowserWindow } from 'electron'
...
app.on('my-open-event', async () => {
try {
"Will call some executable here";
} catch (e) {
console.error(e)
}
})
Run Code Online (Sandbox Code Playgroud)
主文件
import …Run Code Online (Sandbox Code Playgroud) 我有两个模块,我们称它们为core和implementation。如何设置商店以使事物core依赖于所提供的假定商店implementation?
在implementation的商店中,我正在执行以下操作:
import Core from 'core'
export default new Vuex.Store(
new Core().defaultStore
)
Run Code Online (Sandbox Code Playgroud)
这将注册默认状态,变异,动作和获取方法(该设置允许用户implementation扩展/修改由提供的默认存储core)。
core当它尝试访问非Vue JS文件中的getter时,问题就出现在内部动作中。
export default class SomeClassInCore {
exampleMethod() {
// The getters will not be accessible here!
return store.getters.someKey
}
}
Run Code Online (Sandbox Code Playgroud)
有什么方法可以实现“主”存储的“运行时”解析?我在考虑是否可以使用某种方式window来访问由仓库创建的Vue实例implementation?
我试图这样做
import store from './store.js'
import Vue from 'vue'
import { CoreVueTools } from 'core'
window.Vue = Vue
window.store = store
Vue.use(CoreVueTools)
new …Run Code Online (Sandbox Code Playgroud) 我有一个集合Events。这些将根据它们的状态呈现在列表中 - 即将到来的/实时/以前的。因此渲染取决于当前时间。随着时间的推移,如何使计算属性更新/重新计算?
<template>
<div>
<h2>Upcoming events</h2>
<p v-bind:key="event.name" v-for="event in upcomingEvents">{{ event.name }}</p>
<h2>Live events</h2>
<p v-bind:key="event.name" v-for="event in liveEvents">{{ event.name }}</p>
<h2>Previous events</h2>
<p v-bind:key="event.name" v-for="event in previousEvents">{{ event.name }}</p>
</div>
</template>
<script>
import Event from '../Event.js'
export default {
data() {
return {
events: []
}
},
computed: {
upcomingEvents() {
return this.events.filter(event => event.isUpcoming())
},
liveEvents() {
return this.events.filter(event => event.isLive())
},
previousEvents() {
return this.events.filter(event => event.isPrevious())
},
},
mounted() {
// this.events …Run Code Online (Sandbox Code Playgroud) 就像标题所说的那样,我无法使用npm安装字体awesome 5用于scss目的.
根据https://fontawesome.com/how-to-use/use-with-node-js
npm i --save @fortawesome/fontawesome
查看node_modules中的安装,我看不到要连接的scss文件.我尝试在我的app.scss文件中包含styles.css文件,但这不起作用.
的package.json
"font-awesome": "^4.7.0",
app.scss
@import "node_modules/font-awesome/scss/font-awesome.scss";
用法
<i className="fa fa-save icon controlItem"></i>
非常简单.我如何用版本5实现这一点?我使用了错误的包装吗?
显然,只使用@ fortawesome/fontawesome并不是真的.这些包已被拆分,因此您还必须选择
npm install --save @fortawesome/fontawesome-free-regular
Still我没有成功导入它
鉴于webpack.mix.js一个新的 Laravel 项目:
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
Run Code Online (Sandbox Code Playgroud)
仅使用 webpack 和 a 的等价物是webpack.config.js什么?(我希望删除 laravel mix 作为对现有项目的依赖。)
我确实在源代码中找到了这个默认文件,但它没有帮助我。有没有办法可以看到“编译/结果”的 webpack 配置或对应于 laravel 混合默认设置的模板/起点?
我使用react-ace并尝试使用 java 语法的 readme 示例。效果很好。但我似乎无法将其设置为 JSON。
import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-java";
import "ace-builds/src-noconflict/theme-github";
<AceEditor
mode="java"
theme="github"
name="UNIQUE_ID_OF_DIV"
editorProps={{ $blockScrolling: true }}
/>
Run Code Online (Sandbox Code Playgroud)
import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-json";
import "ace-builds/src-noconflict/theme-github";
<AceEditor
mode="json"
theme="github"
name="UNIQUE_ID_OF_DIV"
editorProps={{ $blockScrolling: true }}
/>
Run Code Online (Sandbox Code Playgroud)
拒绝从 '...../worker-json.js' 执行脚本,因为它的 MIME 类型 ('text/html') 不可执行。(匿名)@ 2f896707-86be-497a-93b2-e1711942d7c7:1 2f896707-86be-497a-93b2-e1711942d7c7:1 未捕获的 DOMException: 无法在 '.Worker/GlobalScript' 上执行脚本。 worker-json.js' 加载失败。
如何使用 JSON?
考虑
laravel new bug
Run Code Online (Sandbox Code Playgroud)
然后加入.env
DB_CONNECTION=sqlite
DB_DATABASE=/home/me/Code/bug/storage/database.sqlite
Run Code Online (Sandbox Code Playgroud)
创建数据库
touch /home/me/Code/bug/storage/database.sqlite
Run Code Online (Sandbox Code Playgroud)
迁移
php artisan migrate && php artisan migrate:fresh
Run Code Online (Sandbox Code Playgroud)
现在尝试以修补程序的方式进行迁移
php artisan tinker
>> Artisan::call('migrate');
Run Code Online (Sandbox Code Playgroud)
第一次导致=> 0(如预期的那样?)但是第二次:
>>> Artisan::call('migrate:fresh')
Run Code Online (Sandbox Code Playgroud)
使用消息'SQLSTATE [HY000]照亮\ Database\QueryException:一般错误:17数据库模式已更改(SQL:select*from sqlite_master其中type ='table'和name = migrations)'
Artisan :: call('migrate')第三次:
Symfony\Component\Console\Exception\CommandNotFoundException,消息'在"migrate"命名空间中没有定义命令.
有什么想法在这里发生?你可以重现吗?
Symfony\Component\Console\Exception\CommandNotFoundException,消息'在"migrate"命名空间中没有定义命令.
更新2:此处提交的问题:https
://github.com/laravel/framework/issues/22997 https://github.com/laravel/tinker/issues/37
按照projectstorm / react-diagrams docs中的安装指南进行操作,我对图无法正确渲染感到困扰。检查页面会显示节点的位置-但它们是不可见的。使用sass,我已经导入到app.scss中,
@import "~storm-react-diagrams/src/sass/main";
我也尝试使用原始的最小化CSS,但没有任何改进。
我仍然认为这是我的错误,可能是我在错误的位置创建了引擎?我有一个engineReducer提供默认的引擎。
import * as SRD from "storm-react-diagrams";
//1) setup the diagram engine
var engine = new SRD.DiagramEngine();
engine.installDefaultFactories();
//2) setup the diagram model
var model = new SRD.DiagramModel();
//3-A) create a default node
var node1 = new SRD.DefaultNodeModel("Node 1", "rgb(0,192,255)");
let port1 = node1.addOutPort("Out");
node1.setPosition(100, 100);
//3-B) create another default node
var node2 = new SRD.DefaultNodeModel("Node 2", "rgb(192,255,0)");
let port2 = node2.addInPort("In");
node2.setPosition(400, 100);
// link the ports
let link1 = port1.link(port2); …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个与 npm 依赖项交互的基本笑话测试:react-diagrams
import { DiagramModel } from '@projectstorm/react-diagrams'
test('importing react diagrams', () => {
let x = DiagramModel
});
Run Code Online (Sandbox Code Playgroud)
简单地引用该类DiagramModel会导致此错误:
ReferenceError: self is not defined
> 1 | import { DiagramModel } from '@projectstorm/react-diagrams'
| ^
2 |
3 | test('importing react diagrams', () => {
4 | let x = DiagramModel
at Object.<anonymous> (node_modules/@projectstorm/react-diagrams/dist/index.umd.js:1:331)
at Object.<anonymous> (tests/DiagramModel.test.ts:1:1)
Run Code Online (Sandbox Code Playgroud)
其他测试工作正常,并且依赖项在其他地方捆绑时工作正常。
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
Run Code Online (Sandbox Code Playgroud)
"jest": "^26.6.3",
"ts-jest": "^26.5.2",
...
Run Code Online (Sandbox Code Playgroud)
我有什么想法可以解决这个问题吗? …
javascript ×3
laravel ×3
reactjs ×3
vue.js ×3
vuex ×2
electron ×1
es6-modules ×1
font-awesome ×1
homebrew ×1
jestjs ×1
laravel-mix ×1
npm ×1
react-ace ×1
redux ×1
sass ×1
time ×1
ts-jest ×1
webpack ×1