vue购物车代码

代码语言:html

所属分类:电商

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>BFW NEW PAGE</title>
    <script id="bfwone" data="dep=vue&err=0" type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/bfwone.js"></script>
    <script type="text/javascript">
        bready(function() {
            var app = new Vue({
                el: "#app",
                data() {
                    return {
                        num: null,
                        list: [{
                            id: 0, imgUrl: 'http://repo.bfw.wiki/bfwrepo/image/5e0e942fe0cbf.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_128,h_128,/quality,q_90', price: 2, num: 1, pd: false, isActive: false
                        },
                            {
                                id: 1, imgUrl: 'http://repo.bfw.wiki/bfwrepo/image/5e0e942fe0cbf.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_128,h_128,/quality,q_90', price: 4, num: 1, pd: false, isActive: false
                            },
                            {
                                id: 2, imgUrl: 'http://repo.bfw.wiki/bfwrepo/image/5e0e942fe0cbf.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_128,h_128,/quality,q_90', price: 5, num: 1, pd: false, isActive: false
                            },
                            {
                                id: 3, imgUrl: 'http://repo.bfw.wiki/bfwrepo/image/5e0e942fe0cbf.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_128,h_128,/quality,q_90', price: 3, num: 1, pd: false, isActive: false
                            },
                            {
                                id: 4, imgUrl: 'http://repo.bfw.wiki/bfwrepo/image/5e0e942fe0cbf.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_128,h_128,/quality,q_90', price: 6, num: 1, pd: false, isActive: false
                            }],
                        totalInt: false,
                        newList: []
                    }
                },
                filters: {
                    priceNum: function(val) {
                        return val.toFixed(2)
                    }
                },
                computed: {
                    totalNum: function() {
                        var total = 0;
                        for (var i in this.newList) {
                            if (this.newList[i].pd) {
                                total += this.newList[i].price*this.newList[i].num
                            } else {
                                total = 0
                            }
                        }
                        return total.toFixed(2)
                    },
                    goodsNum: function() {
                        var goods = 0;
                        for (var i in this.newList) {
                            if (this.newList[i].pd) {
            .........完整代码请登录后点击上方下载按钮下载查看

网友评论0