A few days ago a friend sent a movie sharing site: http://dy.bingthink.top/Feel the interface is pretty good, so intend to use Vuejs imitation write one.From the background to the front end, to learn a lot of things, just to record my learning process, idle boredom, to do a little understanding of each technology, PHP is indeed a good language, more suitable for the production of crash site, when the time to develop a crowdfunding site to break the he
Body> DivID= "Example"> Father>Father> Div>Body>Script>Vue.component (' Child', { //Statement Propsprops: ['message'], //just like data, prop can be used within a template //It can also be used in VM instances like "This.message"Template:''}) vue.component ('Father', {Template:'' }) NewVue ({el:'#example' })Script>HTML>Vuejs Component Communication
Global componentsAll instances can use global components.HtmlDOCTYPE HTML>HTML>Head>MetaCharSet= "Utf-8">title>Vue Test Example-Rookie tutorial (runoob.com)title>Scriptsrc= "Https://cdn.bootcss.com/vue/2.2.2/vue.min.js">Script>Head>Body>DivID= "App"> Runoob>Runoob>Div>Script>//RegisterVue.component ('Runoob', {Template:''})//creating the root instanceNewVue ({el:'#app'})Script>Body>HTML>The effect shows the HTML content of the custom component.Local componentsWe can also register the local co
)
. Capture
Follow capture mode to handle
To put it simply, according to my assumptions, it is triggered by the capture sequence (the original pattern is after the capture bubbles first, this is the opposite) (1.0.16)
For. Self, for example, the following code:
"app" >
"test" class="A" >
class="B" >
Events are triggered only when clicked on an area that is not div class= ' B ';④ Custom Key aliases:Specification:Vue.directive ("on"), keycod
data into the DOMIii. Conditions and circulationif= "Seen" > is visible depending on if true, or whether this line of code is run New Vue ({ ' #app1 ', data:{ true } }); for = "key in List" > {{key.text}} Iv. handling user input 1, events2. Two-way binding between form input and application status {{message}} Five, component application construction//Custom Build ' item-list ' and define that the component contains: the Li t
The partial implementation code for the subscription feature is as follows:/* */var uid = 0;/** * A DEP is A observable that can has multiple * directives subscribing to it. */var dep = function dep () {this.id = uid++; This.subs = [];};D Ep.prototype.addSub = function AddSub (sub) {This.subs.push (sub);};D Ep.prototype.removeSub = function Removesub (sub) {Remove (this.subs, sub);};D Ep.prototype.depend = function depend () {if (dep.target) {DEP.TARGET.ADDDEP (this); }};D ep.prototype.notify
When doing a portal project, the customer needs to be personalized, each person enters the home page can be customized page display of the sectionTo display random n components in 4.5 components, in the order in which each person chooses. The demand is over, the next solution:Html:id= "app"> :is= "Item" v-for= "Item in Items ": Key= "item"> Component>div>Js:Const A = {Template: ' = {Template: ' = {Template: ' = {Template: ' }new Vue ({ ' #app ', data: { items: [A,b,d]
problems. It is worth noting that after configuring the agent is not immediately effective, you need to restart the server.We press CTRL + C to stop the service before restarting the service with CNPM run Dev.CNPM Run DevAfter the reboot is complete, open the browser, in the F12 developer tool, you can see the following:We can see that the interface address we requested has become localhost, which means that our interface has been successfully proxied to the local. Then switch to the Priview ta
Some time ago the company leader suggested that a demand is like a circle of friends, brush list has been brushed to the bottom or half of the center, and then click Back or leave the page, then quit to enter the friend Circle page is still realistic or the position of the previous scroll.I am now doing the company after the system, the project list also has a lot of items, has been zoned AH row, click to see the details and then come back there is no location in the original project there, expe
remember to import the library into each file, and then when one of your files is not using this library, remember to remove it from this file. If you do not set up your build tool correctly, you may end up with multiple copies of the same library in your build package.A better wayThe cleanest and most robust way to use JavaScript libraries in a Vue project is to delegate them to the properties of the Vue prototype object. In this way, we add the moment date and time library to our project:Impo
When everything is ready:The first step:Install less dependent,npm install less less---saveStep Two:Modify the Webpack.config.js file, configure the loader load dependency, let it support external less, add the original code{ test:/\.less$/, loader:"style-loader!css-loader!less-loader",},Now basically the installation is complete, and then in the use of the style tag to add lang= "less" inside can write less code.The style tag is added scoped to be valid only in this scopestyle lang="less" sco
needed// ...computed: {fullName: {//GetterGetfunction () { return This. FirstName + "+ This. LastName},//SetterSetfunction(newvalue) {varnames = Newvalue.split (") This. FirstName = Names[0] This. LastName = Names[names.length-1] } }}// ...The vm.fullName = ‘John Doe‘ setter will be called when vm.lastName it is run again, and it will be updated accordingly. vm.firstName v. ListenersAlthough a computed property is more appropriate in most cases, a custom listener is som
is the store(warehouse). "Store" is basically a container that contains most of the state of your app. Vuex and pure global objects have the following two different points:
The state store of the Vuex is responsive. When the Vue component reads state from the store , the corresponding component is effectively updated if the state in the store changes.
You can't directly change the status in the store . The only way to change the state in the store is to explicitly commit (commit) m
Turning the page function on the front end is a problem ah! I finally stepped on it today! Ha ha! Sorting out the method, I was based on Vuejs write, the same applies to angular ha!
Package Download Address: Vue.js Paging component
Screenshot of Effect:
Overall implementation logic, when the user clicks the page number, Ajax gets the data from the backend, including: Records (the current page query to the record), totalrecords:121 (All Records),
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.