...
|
...
|
@@ -5,9 +5,12 @@ |
|
|
*/
|
|
|
var $ = require('jquery');
|
|
|
var $userAvatar = $('.user-avatar');
|
|
|
var myImage = new Image();
|
|
|
var myImage = new Image(),
|
|
|
avatar;
|
|
|
|
|
|
myImage.src = $userAvatar.attr('src');
|
|
|
myImage.onerror = function() {
|
|
|
$userAvatar.attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
|
|
|
// 部分老用户没有头像,显示默认头像
|
|
|
avatar = $userAvatar.data('avatar');
|
|
|
myImage.src = avatar;
|
|
|
myImage.onload = function() {
|
|
|
$userAvatar.css('background-image', 'url(' + avatar + ')');
|
|
|
}; |
...
|
...
|
|