-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1.2更新说明 #4
Comments
1. 修改获取图片初始数据方法 /* 利用自执行函数,将图片名信息转为图片路径信息 */
let imageDatas = ( (arr) => {
for (let i = 0, j = arr.length; i < j; i++) {
let singleImagesData = arr[i];
singleImagesData.imageUrl = require('../images/' + singleImagesData.fileName);
arr[i] = singleImagesData;
}
return arr;
})(imageJsonDatas); 修改为 let imageDatas = imageJsonDatas.map((image) => {
image.imageUrl = require('../images/' + image.fileName);
return image;
}); |
2. 一些小的写法的改变 let imgsArrangeArr = this.state.imgsArrangeArr;
//修改为
let { imgsArrangeArr } = this.state; 使用对象解构赋值语法来减少代码量,增强可读性 let Constant = this.Constant,
centerPos = Constant.centerPos,
hPosRange = Constant.hPosRange,
vPosRange = Constant.vPosRange;
// 修改为
let { centerPos, hPosRange, vPosRange } = this.Constant; |
3. 修改变量的命名,使之可读性更好 this.Constant = {
centerPos: { // 中心图片位置
left: 0,
right: 0
},
hPosRange: { // 水平方向的取值范围,包括左右扇区
leftSecX: [0, 0],
rightSecX: [0, 0],
y: [0, 0]
},
vPosRange: { //垂直方向,只包括上扇区
x: [0, 0],
topY: [0, 0]
}
}; 修改为 this.Constant = {
centerPos: { // 中心图片位置
left: 0,
right: 0
},
leftSection: { // 左扇区,x和y临界值
x: [0,0],
y: [0,0]
},
rightSection: { // 右扇区,x和y临界值
x: [0,0],
y: [0,0]
},
topSection: { // 上扇区,x和y临界值
x: [0, 0],
y: [0, 0]
}
}; |
项目不能start |
@luzhonjun 能告知报错信息吗 |
npm i 时缺少的依赖我补上了,然后start时,控制台报错:找不到GET http://localhost:8000/assets/app.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
v1.2更新说明
The text was updated successfully, but these errors were encountered: