var dataURL = 'data:image/jpg;base64,1123'console.log(dataURL.replace(/^data:image/(png|jpg);base64,/,""))结果: 1123一看就明白了清除data:image/jpg;base64,或data:image/png;base64,开头的字符串
var dataURL = 'data:image/jpg;base64,1123'
console.log(dataURL.replace(/^data:image/(png|jpg);base64,/,""))
结果: 1123
一看就明白了
清除data:image/jpg;base64,或data:image/png;base64,开头的字符串