index.vue
以上用法会出现报错:Property or method "timeLength" is not defined
虽然vue组件中HTML,css,js可以在同一个页面书写,但是js里面的函数、变量是需要使用export default{ }抛出之后html才能使用的。
解决方法:
需要在methods里面再声明一下这个方法
重新定义一个方法,在这个方法里面使用它
function deleteUser(uid) {var xhr = createXhr()
var url = "04_datate.php?uid=" + uid
xhr.open("get", url, true)
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 & xhr.status == 200) {
if (xhr.responsetext == "1") {
alert("删除用户成功")
loadUser()
} else {
alert("删除用户失败")
}
}
}
xhr.send()
}
window.onload = function() {
loadUser()
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)