谁能告诉我该如何解决?它说未定义用户,thx
var updateBtns = document.getElementsByClassName('update-cart')
for(var i = 0; i < updateBtns.length; i++){
updateBtns[i].addEventListener('click', function(){
var productId = this.dataset.product
var action = this.dataset.action
console.log('productId:', productId, 'action:', action )
console.log('USER:', user)
if(user == 'AnonymousUser'){
console.log('Not logged in')
} else {
updateUserOrder(productId, action)
} })
}