2022-10-08
Visual Studio Code常用的扩展插件

  1. Vetur
    vue 代码?亮插件,vue开发神器

  2. Auto Close Tag
    html?动闭合标签插件

  3. Beautify
    格式化插件

  4. Chinese (Simplified) vscode
    汉化插件

阅读更多

2022-10-08
Vue的生命周期

什么是Vue的生命周期 ?

Vue 的实例从创建到销毁的过程 ,就是生命周期 ,也就是从开始创建 ,初始化数据 ,编译模板 ,挂载Dom到渲染DOM ,更新数据再到渲染 ,卸载等一系列的过程 ,我们称这是Vue的生命周期。

阅读更多

2022-10-08
axios中使用异步(async +await)

1.定义方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
async function getIteminfo(id) {

if (id == null) id = getPara();//获取页面参数

var item_options = [];

return await axios({

url: dev_proxyftpname + "/api/findOneById",

method: "post",

data: JSON.stringify({ id: id }),

headers: { "Content-Type": "application/json" },

timeout: 1000 * 30,

})

.then((res) => {

if (res.data) {

if (res.data.data != null) {

return res.data.data;

}

}

})

}
阅读更多

2022-10-08
Vue中全局变量和全局函数的使用

全局变量

1.直接在main.js中通过prototype定义

1
Vue.prototype.accessToken = 'xxx'

在页面中调用:this.accessToken
这种方法简单但是,当需要定义变量很多的时候,管理就很繁杂,这个时候就不宜使用。

阅读更多

2022-10-08
vuex状态管理模式

State:定义存储状态对象

Getter:获取到State后,对其计算返回需要的值(获取计算状态对象)

Mutation:提交更新状态对象(同步,异步使用:Action)

Action:提交一个或多个Mutation,不是直接变更状态

Module:模块化vuex,可以让每一个模块拥有自己的state、mutation、action、getters,使得结构非常清晰,方便管理。

阅读更多
浏览 |

© 2023 南疆 with help from Hexo and Twitter Bootstrap. Theme by Freemind.

container-narrow -->