前端处理ajax返回null值
-
ajax怎么判断后端返回数据为null?前端处理null值
export default { data() { return { userData: null }; }, created() { // 模拟Ajax请求 fetch(‘/api/user’) .then(res =˃ res.json()) .then(data =˃ { // 后端返回null时,use……
export default { data() { return { userData: null }; }, created() { // 模拟Ajax请求 fetch(‘/api/user’) .then(res =˃ res.json()) .then(data =˃ { // 后端返回null时,use……