Skip to content

Commit

Permalink
computed传入参数;
Browse files Browse the repository at this point in the history
  • Loading branch information
simply-none committed May 26, 2022
1 parent 99dcb92 commit fc4e966
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions usage-frame/Vue2知识点.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ inject: Array<string> | { [key: string]: string | Symbol | Object }

当使用修改原数组的方法时,可以检测到数组的变化(响应式):push、pop、unshift、shift、splice、sort、reserve

## computed操作

1. computed传入参数

解释:正常的computed变量,直接传入变量名称即可(就会return 一个返回值过来),若想要传入参数,则里面需要再嵌套一个函数

```vue
computed: {
getCurrentPerson () {
return (personId) => {
return this.persons[personId]
}
}
}
<!-- html中使用 -->
<el-form v-model="getCurrentPerson(21)"></el-form>
```

## vuex基本操作

注意:
Expand Down

0 comments on commit fc4e966

Please sign in to comment.