Giter Site home page Giter Site logo

vue_cart's Introduction

购物车样例

使用的依赖

"axios": "^0.27.2",
"element-plus": "^2.2.2",
"vuex": "^4.0.2"

本来是购物车,但是懒得写后台接口了,直接使用的博客的列表,浏览人数作为了价钱

使用的技术如上依赖所示

使用element大致,计数器,多选框等,正常开发不能这样封装,图省事了哈哈哈

image-20220526201738657

存在文字过长重叠的bug,它提供的pdf的锅,咱也不回调样式

image-20220526201823357

价钱都是使用计算属性做的

let sum = computed({
        get: () => {
            let sum = ref(0.0);
            store.state.checkedList.forEach(e => {
                sum.value += e.num * e.viewsCount;
            })
            return sum;
        }
    });

图省事直接用了vuex作为组建见参数传递,不然要烦死

import {createStore} from 'vuex'

const state = {
    cartList: [],
    checkedList: [],
    selectAll: false,
    isIndeterminate: false
}
const store = createStore({
    state,
})
export default store

使用的时候直接

const store = useStore(); // 使用useStore方法

得到的store直接操作就行了,正常是通过函数set和get的,我是懒蛋呜呜呜

GitHub地址 点我下载压缩包

压缩包不传了呜呜,GitHub又不是不能下,点个Star吧

vue_cart's People

Contributors

lovelinessmoe avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.