1、在页面data中声明全局变量total1并赋值为1
2、在封装的请求方法中将返回的数据值赋值给全局变量total1。(res.totalrecords的值为8)
3、在created()中调用请求方法
4、在mounted()中打印全局变量total1。理论上此时total1的值应该为8,但此时打印出的值为1
1、在页面data中声明全局变量total1并赋值为1
2、在封装的请求方法中将返回的数据值赋值给全局变量total1。(res.totalrecords的值为8)
3、在created()中调用请求方法
4、在mounted()中打印全局变量total1。理论上此时total1的值应该为8,但此时打印出的值为1