Vue2.0 implements the shopping cart function and vue2.0 implements the shopping cart function.
Introduction
Vue. js is a set of MVVM frameworks developed by Yu Yuxi, a Chinese user. Vue. the core of js is a system that allows you to use concise template syntax to declare and render data into the DOM. It is very suitable for front-end applications with complex interaction logic, for example, some single-page applications have many form operations, and the content on the page needs to be dynamically changed based on user operations.
Main features:
1. Responsive Data Binding
2. componentized Development
3. Virtual DOM
Development Preparation
Tools
The editor I use is sublime text3. First install a plug-in sublimeServer to build an http server. For details, see this blog article: Configure Chrome to support local (file protocol) AJAX request
Download related vue files
1. vue-resource.js
2. vue. min. js (you can also use vue. js. The development version has an error prompt)
All files and descriptions
The data folder stores related data. Because the database is not connected, the data is displayed in json format. In fact, the database stores data in json format, we simulate communication with the database in this way.
The lib folder stores the imported vue files.
Create a vue instance in the js file.
Page display
Shopping Cart interface:
This shopping cart provides the following functions: full selection, automatic calculation of the total amount, and deletion:
Click "checkout" to go to the shipping address selection page. Click "more" to show more options, set an address as the default address, and specify the delivery method.
Key knowledge points
Vue is an MVVM framework.
M (model, data ):
V (view, DOM view ):
VM (view-model, communication)
Source Code address: https://github.com/Paranoidyang/vue2.0-shoppingCart
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.