qauMaWeb/node_modules/.cache/babel-loader/b9fbe500748be88d00b7a85fc4b...

1 line
3.3 KiB
JSON

{"ast":null,"code":"import \"core-js/modules/es.number.constructor.js\";\nimport \"core-js/modules/es.regexp.exec.js\";\nimport \"core-js/modules/es.string.replace.js\";\nimport \"core-js/modules/es.array.filter.js\";\nimport \"core-js/modules/es.object.to-string.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport CartItem from \"@/components/CartItem\";\nexport default {\n name: \"Cart\",\n data: function data() {\n return {\n userId: Number,\n carts: []\n };\n },\n components: {\n 'cart-item': CartItem\n },\n created: function created() {\n var _this = this;\n\n this.request.get(\"/userid\").then(function (res) {\n _this.userId = res;\n\n _this.request.get(\"/api/cart/userid/\" + _this.userId).then(function (res) {\n if (res.code === '200') {\n _this.carts = res.data;\n\n for (var i = 0; i < _this.carts.length; ++i) {\n _this.carts[i].createTime = _this.carts[i].createTime.toLocaleString().replace(/T/g, ' ').replace(/\\.[\\d]{3}Z/, '');\n }\n }\n });\n });\n },\n methods: {\n delItem: function delItem(id) {\n this.carts = this.carts.filter(function (item) {\n return item.id != id;\n });\n }\n }\n};","map":{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA;AACA;AACAA,cADA;AACAC,MADA,kBACA;AACA;AACAC,oBADA;AAEAC;AAFA;AAIA,GANA;AAOAC;AACA;AADA,GAPA;AAUAC,SAVA,qBAUA;AAAA;;AACA;AACA;;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA,OAPA;AAQA,KAVA;AAYA,GAvBA;AAwBAC;AACAC,WADA,mBACAC,EADA,EACA;AACA;AAAA;AAAA;AACA;AAHA;AAxBA","names":["name","data","userId","carts","components","created","methods","delItem","id"],"sourceRoot":"src/views/front/good","sources":["Cart.vue"],"sourcesContent":["<!--\r\n * @Description: \r\n * @Author: Rabbiter\r\n * @Date: 2023-03-26 15:27:05\r\n-->\r\n<template>\r\n<div style=\"width: 55%;height:100%;margin: 20px auto\">\r\n <div v-if=\"carts.length === 0\" class=\"empty-box\">\r\n <span style=\"font-family: 华文彩云;font-size: 40px\" >购物车是空的哦</span>\r\n </div>\r\n <template v-for=\"cart in carts\">\r\n <cart-item :cart=\"cart\" @delete=\"delItem\" :key=\"cart.id\" style=\"margin-bottom: 10px\"></cart-item>\r\n </template>\r\n</div>\r\n</template>\r\n\r\n<script>\r\nimport CartItem from \"@/components/CartItem\";\r\nexport default {\r\n name: \"Cart\", data(){\r\n return{\r\n userId: Number,\r\n carts: [],\r\n }\r\n },\r\n components:{\r\n 'cart-item': CartItem,\r\n },\r\n created() {\r\n this.request.get(\"/userid\").then(res=> {\r\n this.userId = res;\r\n this.request.get(\"/api/cart/userid/\"+this.userId).then(res=>{\r\n if(res.code==='200'){\r\n this.carts = res.data;\r\n for(var i = 0; i < this.carts.length; ++i) {\r\n this.carts[i].createTime = this.carts[i].createTime.toLocaleString().replace(/T/g, ' ').replace(/\\.[\\d]{3}Z/, '');\r\n }\r\n }\r\n })\r\n })\r\n\r\n },\r\n methods:{\r\n delItem(id){\r\n this.carts = this.carts.filter(item => item.id != id)\r\n }\r\n },\r\n}\r\n</script>\r\n\r\n<style scoped>\r\n.empty-box{\r\n border-radius: 30px;\r\n text-align: center;\r\n background-color: white;\r\n padding: 100px;\r\n}\r\n</style>"]},"metadata":{},"sourceType":"module"}