我在GitLab. 我更改了.eslint.json使用来自 StackOverflow 的信息的设置。但我仍然有问题。
我的.eslint.json样子:
{
"extends": "eslint:recommended",
"rules": {
"semi": ["warn", "never"],
"quotes": ["warn", "single"],
"no-console": ["off"]
},
"parserOptions": {
"ecmaVersion": 9
},
"env": {
"es6": true,
"node": true,
"browser": true,
"amd": true
},
"globals": {
"$": true,
"require": true
"process": true
},
"root": true
}
Run Code Online (Sandbox Code Playgroud)
在env我添加"adm": true和在globals我添加"process": true和"require": true。
错误是:
错误 'require' 未定义 no-undef
错误“进程”未定义 no-undef
错误所在的文件如下所示:
{
"extends": "eslint:recommended",
"rules": { …Run Code Online (Sandbox Code Playgroud) 我想问,因为我仍然很难理解
v-model和之间的区别,:model-value
在文档中,我读到:
v-model is used on a native element:
<input v-model="searchText" />
Run Code Online (Sandbox Code Playgroud)
但是,当我在组件上使用时,v-model会扩展为:
<CustomInput
:modelValue="searchText"
@update:modelValue="newValue => searchText = newValue"
/>
Run Code Online (Sandbox Code Playgroud)
好吧,我明白了。但有时我发现,在自定义组件中我们仍然使用:
<CustomInput
v-model="searchText" // => why v-model, not :model-value
@update:modelValue="newValue => searchText = newValue"
/>
Run Code Online (Sandbox Code Playgroud)
所以我有点困惑,为什么,这两个选项之间有什么区别。
我的vue.js项目有问题。我有一个函数,我必须在我的项目中添加它。当我添加index.html我的函数(它是在头项目中创建 tagManager 的函数)时,属性不起作用。所以我尝试在mounted(). 但是我仍然有一个问题,如何将它添加到 tempate。我的功能是:
<script>
(function(w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
"gtm.start": new Date().getTime(),
event: "gtm.js"
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != "dataLayer" ? "&l=" + l : "";
j.async = true;
j.src = "https://www.googletagmanager.com;
f.parentNode.insertBefore(j, f);
})(window, document, "script", "dataLayer");
</script>
Run Code Online (Sandbox Code Playgroud)
我想我会将这个脚本设置为mounted,然后做document.head.appendChild。但是函数太复杂了,所以有问题。知道如何将此脚本添加到我的项目头部吗?
我有一个字符串
var numb = "R$ 2000,15"
我想剪掉最后两个数字和逗号,并 R$加上空格,以获得结果 => 2000。
我尝试使用 regex:(?!\d{1,5}),(?:\d{2})并且它需要 result: R$ 2000。所以现在我想用空格删除 R$ 。
有什么帮助吗?
我尝试使用 .modal-header 更改 b-modal -> in .modal-header 中的背景颜色bootstrap-vue。但是 vue 没有看到我的样式,我不知道为什么:/这里是代码。我按照链接中的答案
HTML:
b-modal(id="card-1" title="CARTÃO DE CRÉDITO" :modal-class="myclass" header-text-variant="light")
Run Code Online (Sandbox Code Playgroud)
VUE
export default {
data: {
myclass: ['myclass']
},
Run Code Online (Sandbox Code Playgroud)
}
CSS
.myclass > .modal-dialog > .modal-content > .modal-header {
background-color: #da2228 !important;
color: white;
}
Run Code Online (Sandbox Code Playgroud)
但我仍然没有看到结果。模态标题为白色。任何想法为什么?