这是vuex官网给出的示例,很容易理解
const Counter = {
template: `<div>{{ count }}</div>`,
computed: {
count () {
return store.state.count
}
}
}
我现在想在html的属性里使用count,如
const Counter = {
template: `<img src="{{img}}">`,
computed: {
count () {
return store.state.img
}
}
}
但是这么写是不行的,请问如过要实现这种效果该怎么实现呢?
用 :src="$store.state.img" 或者 :src="count"