Web/12-Vue基础/Vue.js在开发中的常见写法积累.md
2021-07-29 11:08:52 +08:00

36 lines
638 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 01-数据库的基础知识
publish: false
---
<ArticleTopAd></ArticleTopAd>
### 001、对象的赋值
1在 store 中定义一个对象:
```javascript
userInfo: {
pin: '',
nickName: '',
avatarUrl: DEFAULT_AVATAR,
definePin: '',
isbind: true
},
```
2从接口拿到数据后给这个对象赋值
```javascript
this.userInfo = {
...this.userInfo,
pin: res.base.curPin,
nickName: res.base.nickname,
avatarUrl: res.base.headImageUrl ? res.base.headImageUrl : DEFAULT_AVATAR,
definePin: res.definePin
}
```