我想通过操作将更改应用于 vuejs 应用程序中的变量。但我收到这个错误说[vuex] unknown local mutation type: updateValue, global type: app/updateValue
这是我的商店文件夹结构:
-store
-modules
-app
-actions.js
-getters.js
-mutations.js
-state.js
-index.js
-actions.js
-getters.js
-mutations.js
-state.js
-index.js
Run Code Online (Sandbox Code Playgroud)
这是我的./store/index.js文件:
-store
-modules
-app
-actions.js
-getters.js
-mutations.js
-state.js
-index.js
-actions.js
-getters.js
-mutations.js
-state.js
-index.js
Run Code Online (Sandbox Code Playgroud)
这是我的./store/modules/index.js:
import Vue from 'vue'
import Vuex from 'vuex'
import actions from './actions'
import getters from './getters'
import modules from './modules'
import mutations from './mutations'
import state from './state'
Vue.use(Vuex)
const store = new …Run Code Online (Sandbox Code Playgroud) 我将一个值列表从父组件传递给它的子组件,并希望接收所有值,但我只接收最后一个。
这是父组件的代码:
<app-spider-web
v-for="skill in skills"
:name="skill.name"
:required="skill.required"
:vMode1="skill.vMode1"
></app-spider-web>
...
skills: [
{
name: 'Frozen Yogurt',
required: 1,
vMode1: ''
},
{
name: 'Ice cream sandwich',
required: 3,
vMode1: ''
},
{
name: 'Eclair',
required: 1,
vMode1: ''
}
]
Run Code Online (Sandbox Code Playgroud)
这是子组件的代码:
props:['name','required','vMode1']
Run Code Online (Sandbox Code Playgroud)
这样我一个一个接收数据,如果我想打印例如'name',它只显示列表中的姓氏'Eclair',而我想在子组件中有一个数组,其中包含所有名称。最好的方法是什么?
我是 Nuxt 新手,我想在我的网络选项卡中查看我的 API 调用。我知道 Nuxt 是 SSR,它不会在fetch()网络选项卡的挂钩中显示 API。我在网上搜索了很多,但找不到在网络选项卡中检查 API 调用的方法。所以我想知道是否有一种方法可以fetch()在网络选项卡中查看挂起的 API 调用,以便使用 Nuxt 检查它们?
fetch google-chrome-devtools vue.js server-side-rendering nuxt.js
所以我有两个清单:
num = [
3, 22, 23, 25, 28, 29, 56, 57, 67, 68, 73, 78, 79, 82, 83, 89, 90, 91,
92, 98, 99, 108, 126, 127, 128, 131, 132, 133
]
details = [
'num=10,time=088', 'num=10,time=084', 'num=10,time=080', 'num=10,time=076',
'num=10,time=072', 'num=10,time=068', 'num=10,time=064', 'num=10,time=060',
'num=10,time=056', 'num=10,time=052', 'num=10,time=048', 'num=10,time=044',
.
.
.
.
'num=07,time=280', 'num=07,time=276', 'num=05,time=508', 'num=05,time=504',
'num=05,time=500', 'num=05,time=496'
]
Run Code Online (Sandbox Code Playgroud)
num有 28 个元素,details有 134 个元素。我想details根据 中的值按索引删除元素num。例如,索引为 3、22、23、25、28...(这些是num列表中的数字)的元素应从 中删除details。
当我按照此处 …
我的页面上有一个按钮,可滚动回到页面顶部。它可以工作,但是我希望滑动平滑而不是瞬间。有什么好方法吗?
请注意,此网站上也有类似的问题,但它们均未使用Vuetify。
这是我的按钮:
<v-btn
class="md-5 mr-3 elevation-21"
dark
fab
button
right
color="indigo darken-3"
fixed
@click="top"
>
Run Code Online (Sandbox Code Playgroud)
这是我的功能:
methods:{
top(){
window.scrollTo(0,0);
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个函数,在 python 中使用 PyQt4 单击按钮后会弹出一个消息框。我使用“sender()”来确定单击了哪个按钮,然后相应地设置弹出窗口的文本。该函数与“if 语句”完美配合。但是我想知道如何使用字典编写具有相同功能的函数(因为python中没有switch语句并且我的代码中有太多if语句)?
def pop_up(self):
msg = QtGui.QMessageBox()
msg.setIcon(QtGui.QMessageBox.Information)
sender = self.MainWindow.sender()
if sender is self.button1:
msg.setText("show message 1")
elif sender is self.button2:
msg.setText("show message 2")
elif sender is self.button3:
msg.setText("show message 3")
elif sender is self.button4:
msg.setText("show message 4")
elif sender is self.button5:
msg.setText("show message 5")
elif sender is self.button6:
msg.setText("show message 6")
.
.
.
.
.
elif sender is self.button36:
msg.setText("show message 36")
msg.exec()
Run Code Online (Sandbox Code Playgroud) 我有 4 个可扩展菜单和 5 个按钮。Collapse first按钮展开/关闭第一个菜单,Collapse second按钮展开/关闭第二个菜单,依此类推。
原样:Collapse all每个菜单的按钮在展开时将其关闭,如果关闭则将其展开。
想要成为:而我希望我的Collapse all按钮在关闭时展开所有菜单,并且在展开时不要更改它们。然后如果再次单击关闭所有展开的菜单并且不更改关闭的菜单。这里是一个小提琴我写因为它是:扩大菜单fidlle
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}Run Code Online (Sandbox Code Playgroud)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css" rel="stylesheet"/>
<p>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample1, #collapseExample2, #collapseExample3, #collapseExample4" aria-expanded="false" aria-controls="collapseExample">
Collapse all
</button>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample1" aria-expanded="false" aria-controls="collapseExample">
Collapse first
</button>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample2" aria-expanded="false" …Run Code Online (Sandbox Code Playgroud)我想在 Vuetify 中动态更改工具栏的颜色(请注意,我知道本网站上有类似的帖子,但没有一个使用 Vue)
我曾经v-bind:style这样做过,但它不起作用!这是我的模板及其各自的脚本:
<v-toolbar
flat
fixed
app
v-bind:style="{ color: dynamic }"
light
scroll-off-screen
>
...
data: () => ({
dynamic: 'black'
})
Run Code Online (Sandbox Code Playgroud) 我有一个列表(单击小提琴):
<ul class="list-items" :style="styleObject">
<li v-for="(item, index) in listItems" :key="index">
<span v-if="index != 0">, </span><span>{{ item.name }}</span>
</li>
</ul>
<style lang="scss" scoped>
.list-items {
display: inline-flex;
}
ul {
list-style-type: none;
}
</style>
Run Code Online (Sandbox Code Playgroud)
它看起来像这样:
这在桌面上很棒,但是当屏幕变小时,单词会被打乱而不是转到下一行:
我想要的是,每当最后一个单词超过屏幕宽度时,它就会转到下一行,这样我的列表就不会像上图那样乱七八糟,我该怎么做?
注意
不确定它是否重要,但class="list-items"在具有以下样式的 div 中:
display: flex;
align-items: center;`
Run Code Online (Sandbox Code Playgroud) vue.js ×6
javascript ×3
css ×2
python ×2
vuetify.js ×2
action ×1
arrays ×1
bootstrap-4 ×1
data-binding ×1
dictionary ×1
expand ×1
expandable ×1
fetch ×1
html ×1
html-lists ×1
if-statement ×1
list ×1
menu ×1
mutation ×1
nuxt.js ×1
pyqt4 ×1
scroll ×1
store ×1
vue-props ×1
vuejs2 ×1
vuex ×1