js 驼峰转下划线
hump2Underline(s) {
return s.replace(/([A-Z])/g, '_$1').toLowerCase()
},
// JSON对象的key值转换为下划线格式
jsonToUnderline(obj) {
var that = this;
if (obj instanceof Array) {
obj.forEach(function (v, i) {
that.jsonToUnderline(v)
})
} else if (obj instanceof Object) {
Object.keys(obj).forEach(function (key) {
var newKey = that.hump2Underline(key)
if (newKey !== key) {
obj[newKey] = obj[key]
delete obj[key]
}
that.jsonToUnderline(obj[newKey])
})
}
},