我的组件很简单:
<template>
<btn :color="color" @click="toggleColor">{{btnmsg}}</btn>
</template>
<script>
import { Btn } from 'chico'
export default {
name: 'AButton',
components: {
Btn
},
data() {
return {
btnmsg: 'Legia pany',
colors: [
'blue', 'black', 'green',
'orange', 'teal', 'cyan',
'yellow', 'white'
],
color: 'red'
}
},
methods: {
toggleColor() {
this.color = this.colors[Math.floor(Math.random() * Math.floor(this.colors.length))];
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
ChicoFamily 的内容<Btn>是这样的:
<template>
<button :is="tag" :class="[className, {'active': active}]" :type="type" :role="role">
<slot></slot>
</button>
</template>
<script>
import classNames from 'classnames';
export default { …Run Code Online (Sandbox Code Playgroud) 如果我在 Visual Studio Code 和 Matplotlib 中使用深色主题,则可以将图形配置为深色背景,但小部件/单元格的背景仍然是白色。
%matplotlib widget
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('dark_background')
figure, axis = plt.subplots()
axis.plot(np.arange(100))
Run Code Online (Sandbox Code Playgroud)
如果我使用 Jupyter 扩展的选项在笔记本中使用 Visual Studio Code 主题,也会发生这种情况(实际上,情况会更糟,因为轴标签不可见)。
请注意,我需要用作%matplotlib widget渲染器,并且不能使用%matplotlib inline. 对于内联,我找到了一个有效的配置。
在浏览器中,如果我选择 Jupyter 深色主题,它就会起作用,所以我想,如果可能的话,我会在 Jupyter 渲染器扩展中选择不同的“主题”(?)
有没有办法配置 Jupyter 扩展/Visual Studio Code/...以获得真正的“Matplotlib 黑暗模式”?
我不是前端开发人员,但我正在尝试在 Rails 5.1 应用程序中整理我的 javascript/Vue.js 文件。我对节点生态系统不太熟悉。我收到以下错误,想知道从哪里开始解决这个问题:
Tue Apr 17$ eslint javascript/ --ext .vue
Cannot find module 'eslint-plugin-vue'
Referenced from: /Users/jt/repos/embers2/.eslintrc.js
Error: Cannot find module 'eslint-plugin-vue'
Referenced from: /Users/jt/repos/embers2/.eslintrc.js
at ModuleResolver.resolve (/usr/local/lib/node_modules/eslint-config-airbnb-standard/node_modules/eslint/lib/util/module-resolver.js:74:19)
at resolve (/usr/local/lib/node_modules/eslint-config-airbnb-standard/node_modules/eslint/lib/config/config-file.js:466:29)
at load (/usr/local/lib/node_modules/eslint-config-airbnb-standard/node_modules/eslint/lib/config/config-file.js:542:26)
at configExtends.reduceRight (/usr/local/lib/node_modules/eslint-config-airbnb-standard/node_modules/eslint/lib/config/config-file.js:421:36)
at Array.reduceRight (<anonymous>)
at applyExtends (/usr/local/lib/node_modules/eslint-config-airbnb-standard/node_modules/eslint/lib/config/config-file.js:403:28)
at loadFromDisk (/usr/local/lib/node_modules/eslint-config-airbnb-standard/node_modules/eslint/lib/config/config-file.js:514:22)
at Object.load (/usr/local/lib/node_modules/eslint-config-airbnb-standard/node_modules/eslint/lib/config/config-file.js:550:20)
at Config.getLocalConfigHierarchy (/usr/local/lib/node_modules/eslint-config-airbnb-standard/node_modules/eslint/lib/config.js:228:44)
at Config.getConfigHierarchy (/usr/local/lib/node_modules/eslint-config-airbnb-standard/node_modules/eslint/lib/config.js:180:43)
Tue Apr 17$
Run Code Online (Sandbox Code Playgroud)
我的 .eslint.js 文件是:
module.exports = {
extends: [
// add more generic rulesets here, such as:
// 'eslint:recommended',
'plugin:vue/essential', …Run Code Online (Sandbox Code Playgroud) 许多第三方 Whatsapp 模组都开发了许多很酷的功能,例如自动回复、感兴趣的人上线时的通知、消息计时器等。当 Whatsapp 尚未发布任何源代码并且逆向工程变得太难时,这些人是如何做到的能够构建这样的功能吗?
我想我对Vue + Vuex有误解。
我有一个 Vuex 状态,其中包含一个列表过滤器。列表中的每个过滤器项目都可以标记为已选择。但是 - Vuex 状态只能在单击应用按钮时通过修改器进行修改,以便其他组件可以对更改做出反应。
例如,列表将根据所选过滤器重新加载数据。当状态更新时,组件也应该更新。
我创建了一个CodePen:
https://codepen.io/anon/pen/OzEJWP?editors=1010
https://jsfiddle.net/rxqu7ame/
Vue.component('filter-item', {
template: ` <div>
<!--{{item.color}} ({{item.selected}}) <button @click="item.selected = !item.selected">toggle</button>-->
{{item.color}} ({{isSelected}}) <button @click="isSelected = !isSelected">toggle</button>
</div>`,
data: function () {
return {
isSelected: this.item.selected
}
},
computed: {
/*isSelected : function(){
return this.item.selected;
}*/
},
props: ['item']
});
Run Code Online (Sandbox Code Playgroud)
我遇到了不同的问题:
selected当我直接在模板内切换属性时filter-item,Vuex 状态也会更新(我不想要)。
因此,我尝试使用状态初始化数据属性(组件的本地属性),这样只有数据变量isSelected会被更新。当我按下“应用”按钮时,Vuex 状态将被更新(稍后我将使用突变)。到目前为止,一切都很好。但现在,isSelected当状态发生变化时,该属性不会自动更新。
如果我使用计算属性,isSelected则无法在单击事件中更改(因为它是只读的)。
实现我想要的场景的正确方法是什么?
var base64str="data:image/jpeg;base64,***"//base64 format of the image
var buf = Buffer.from(base64str, 'base64');
jimp.read(buf, (err, image) => {
if (err) throw err;
else {
image.crop(140, 50, 200, 280)
.quality(100)
.getBase64(jimp.MIME_JPEG, function(err, src) {
console.log("rb is \n")
console.log(src);
})
}
})
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用 npm 中的 jimp 包来裁剪图像的 base64 格式,但出现如下错误:
Error: Could not find MIME for Buffer <null>
at Jimp.parseBitmap (D:\Node\image-crop\node_modules\@jimp\core\dist\utils\image-bitmap.js:108:15)
at new Jimp (D:\Node\image-crop\node_modules\@jimp\core\dist\index.js:425:32)
at _construct (D:\Node\image-crop\node_modules\@jimp\core\dist\index.js:100:393)
at D:\Node\image-crop\node_modules\@jimp\core\dist\index.js:932:5
at new Promise (<anonymous>)
at Function.Jimp.read (D:\Node\image-crop\node_modules\@jimp\core\dist\index.js:931:10)
at Object.<anonymous> (D:\Node\image-crop\index.js:46:6)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js …Run Code Online (Sandbox Code Playgroud) 我正在使用 Laravel - 5.8 和 Vue.js。我的问题是关于如何在 Vee-Validate 库中显示规则的自定义错误消息。我的“必需”规则的自定义消息没有显示,而是显示:“first_name 字段是必需的。” 预期的消息是“请输入名字”。
下面的代码在 app.js 中
import { ValidationProvider } from 'vee-validate/dist/vee-validate.full';
Run Code Online (Sandbox Code Playgroud)
这是我的 HTML 组件代码。
<template>
<div>
<form role="form">
<ValidationProvider name="first_name" :rules="required">
<div slot-scope="{ errors }">
<input v-model="profileForm.first_name" class="form-control">
<p>{{ errors[0] }}</p>
</div>
</ValidationProvider>
<button type="button" @click="validateBeforeSubmit()">Update Profile</button>
</form>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
下面是我的 JS 脚本代码
<script>
import { localize } from 'vee-validate/dist/vee-validate.full';
import en from "vee-validate/dist/locale/en.json";
export default {
data() {
return {
profileForm: {
first_name: ''
},
customMessages: {
en: {
custom: { …Run Code Online (Sandbox Code Playgroud) 我正在尝试按照官方 Vee-Validate 指南构建一个多步骤表单向导,它提供的示例可在此处找到。虽然这是有帮助的,我想结合Vuex到这一点,我使用的自定义组件,而不是V型验证的默认<Form/>和<ErrorMessage/>组件。自定义组件在内部不使用 Vee-Validate 默认组件。
然而,这样做给我带来了一些问题。我目前的问题是我不知道如何让我的 Vuex 状态变成 Vee-Validate反应式。
我的主要组件中的文本输入是这样使用的:
<text-input
label="Name"
name="name"
v-model="name"
/>
...
computed: {
...mapGetters({
businessFields: 'business/businessFields',
}),
name: {
get () {
return this.businessFields.name;
},
set (value) {
this.$store.commit('business/setName', value)
}
},
},
Run Code Online (Sandbox Code Playgroud)
这都是根据Vuex 在这里给出的双向计算属性指南。
现在我正在尝试将这些字段合并到之前链接的 Vee-Validate 多表单向导中。我基本上改变了它以在重置和从 Vuex 来回而不是本地值时获取值。像这样:
<!-- FormWizard.vue (from the Vee-Validate example adapted to use Vuex) -->
<template>
<form @submit="onSubmit">
<slot />
<div>
<button v-if="hasPrevious" type="button" @click="goToPrev">
Previous
</button>
<button type="submit">{{ …Run Code Online (Sandbox Code Playgroud) 如何从DateTimeOffset对象中提取日期?我认为Date属性只会返回日期部分。但是,我不断获得整个日期时间,即7/17/2014 12:00:00 AM -04:00。我只想获取日期部分7/17/2014。
这是我的代码。
Func<DataRow, string, DateTimeOffset?> getFieldNullableDate = (row, field) =>
{
if (!string.IsNullOrWhiteSpace((row[field] ?? string.Empty).ToString()))
return DateTimeOffset.Parse(row[field].ToString()).Date;
else
return null;
};
Run Code Online (Sandbox Code Playgroud) 在 VS2019 中,当我启动 ASP.NET Core 5 应用程序(仅公开 API)时,会弹出该应用程序的控制台窗口。曾经有一些设置来决定是将其作为控制台/独立应用程序运行还是将其托管在 IIS Express 中。我一直更喜欢控制台/独立版本,因为它可以让我实时查看日志。
然而,在 VS2022 中,当我启动同一个项目时,根本没有出现任何窗口,而且有趣的是,我也没有看到 IIS Express 启动。
我怎样才能回到让项目作为控制台应用程序启动?(除了从命令行启动它然后附加调试器。)
我只是注意到,奇怪的是,正在创建一个最小化的控制台窗口,因为我启动了十几个项目(微服务),所以我之前没有注意到它,并且 procexplorer 告诉我可执行文件没有窗口,这增加了混乱。
因此,尽管仍然很奇怪,但问题要小得多 - 为什么这个特定的应用程序不会以非最小化的方式启动?它与所有其他可执行文件的唯一区别是它使用 ASP.NET Core,而其他(所有通过消息队列通信的后台服务)则不使用。
这种情况只发生在 VS2022 中,在 VS2019 中,包括此在内的所有可执行文件都以未最小化的方式启动。
vue.js ×4
vee-validate ×2
vuex ×2
android ×1
asp.net-core ×1
c# ×1
console ×1
datetime ×1
debugging ×1
eslint ×1
image ×1
ipywidgets ×1
javascript ×1
jimp ×1
jupyter ×1
laravel ×1
laravel-5.8 ×1
logging ×1
matplotlib ×1
mutation ×1
node.js ×1
npm ×1
vue-props ×1
vuejs2 ×1
vuejs3 ×1
vuex4 ×1
whatsapp ×1