我想构建我的js/css代码,将其写在磁盘上并使用webpack-dev-server在单个命令中提供它.我不想为生产模式设置另一台服务器.我们该怎么做呢?在下面分享我的webpack.config.js文件内容:
module.exports = {
watch: true,
entry: [
'./src/index.js'
],
output: {
path: __dirname +'/dist/',
publicPath: '/dist/',
filename: 'bundle.js'
},
module: {
loaders: [
{
exclude:/(node_modules)/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
},
devServer: {
historyApiFallback: true,
contentBase: './'
}
};
Run Code Online (Sandbox Code Playgroud)
请在下面找到package.json中使用的启动脚本:
"start": "webpack-dev-server --progress --colors"
Run Code Online (Sandbox Code Playgroud)
我正在运行"npm run start".请帮忙.
我正在尝试使用Vega-Lite开发交互式图表,但我无法找到任何引用交互式图表的文档,主要是事件用户.
所以,想知道Vega-Lite是否具备这种能力.
请帮助我,因为我是新手,如果可能的话,最好使用Vega-Lite开发交互式图表; 否则我会和Vega一起去.
我想更改 Vega-Lite 条形图中条形的默认蓝色。我该怎么做?我在下面发布了 json 规范:
{
"data": {
"values": [
{"a":"A", "b":28}, {"a":"B", "b":55}, {"a":"C", "b":43},
{"a":"D", "b":91}, {"a":"E", "b":81}, {"a":"F", "b":53},
{"a":"G", "b":19}, {"a":"H", "b":87}, {"a":"I", "b":52}
]
},
"mark": "bar",
"encoding": {
"x": {bin:false, "type": "ordinal","field": "a"},
"y": {"type": "quantitative","field": "b"}
}
}
Run Code Online (Sandbox Code Playgroud)
提前致谢。
是否有在 vuex 模块或普通 js 模块中使用插件的正确/记录方式?我正在使用事件总线来实现它,不确定它是否是正确/最好的方法。请帮忙。
Plugin1.plugin.js:
const Plugin1 = {
install(Vue, options) {
Vue.mixin({
methods: {
plugin1method(key, placeholderValues = []) {
return key;
},
},
});
},
};
export default Plugin1;
Run Code Online (Sandbox Code Playgroud)
在 App.vue 中:
Vue.use(Plugin1, { messages: this.plugin1data });
Run Code Online (Sandbox Code Playgroud)
在商店/plain-js 模块中:
const vue = new Vue();
const plugin1method = vue.plugin1method;
Run Code Online (Sandbox Code Playgroud) 我是Vega和Vega-Lite的新手。我正在使用Vega-Lite创建一个简单的条形图,但无法添加任何事件侦听器,例如“悬停”。
我想悬停一个栏并更改栏的颜色。
我正在学习 graphQL。有人可以帮助我理解为什么架构中没有识别突变吗?
出现此错误:
Error: "Mutations" defined in resolvers, but not in schema
Run Code Online (Sandbox Code Playgroud)
以下是代码:
架构:
const typeDefs = gql`
type Author {
age: String
name: String
books: [String]
}
type Query {
authors: [Author]
author(id: String): Author
}
type Mutation {
addAuthor(name: String, age: Int, books: [String]): Author
}
`;
const schema = makeExecutableSchema({ typeDefs, resolvers });
export default schema;
Run Code Online (Sandbox Code Playgroud)
解析器:
const resolvers = {
Query: {
authors: () => {
// return authors;
},
author: (root, { id }) => …
Run Code Online (Sandbox Code Playgroud) 我试图模块化我的代码并将控制器移动到使用相同模块的单独文件中.但是,它没有加载,我确保加载顺序是正确的.
// app.js
angular.module("app", []);
// LoginCtrl.js
angular.module("app", []).controller("LoginCtrl", function()
{
//doSomeThing
});
Run Code Online (Sandbox Code Playgroud)
如果我在第一个文件中执行var app = angular.module并在其他文件中使用相同的变量,它就可以工作.
// app.js
var app = angular.module("app", []);
// LoginCtrl.js
app.controller("LoginCtrl", function()
{
//doSomeThing
});
Run Code Online (Sandbox Code Playgroud)
如果我将所有代码移动到一个文件中并分别对每个组件使用angular.module,它就可以工作.
// app.js
angular.module("app", []);
angular.module("app", []).controller("LoginCtrl", function()
{
//doSomeThing
});
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
javascript module controllers angularjs angularjs-controller
javascript ×4
d3.js ×3
vega ×3
vega-lite ×3
node.js ×2
angularjs ×1
bar-chart ×1
controllers ×1
ecmascript-6 ×1
graphql ×1
module ×1
mongodb ×1
react-apollo ×1
reactjs ×1
vue.js ×1
vuejs2 ×1
vuex ×1
vuex-modules ×1
webpack ×1