Detailed explanation of Cpage.js binding event instances to components

巴扎黑
Release: 2017-09-01 10:50:38
Original
1022 people have browsed it

Cpage.js is a lightweight Mvvm framework developed using TypeScript (a superset of JavaScript). Through this article, I will share with you the implementation code of Cpage.js binding events to components. Friends who need it can refer to it

Cpage.js is a lightweight Mvvm framework that uses TypeScript (JavaScript's super set) development.

Built-in template engine, routing, instructions, http, dom and other modules. It can easily carry out component development, has unified syntax and is easy to use, does not rely on third-party frameworks, and is suitable for the development of small and medium-sized projects.

Cpage.js can not only bind events to ordinary elements, but also to components!

First, we can define a component header


var header = Cpage.component({ name: 'header', components: [], template: `

{{header}}--{{height}}

`, data: { header: 'this is header' }, props: { height: { default: '10' } }, beforeRender() { }, render() { } });
Copy after login

and then reference it wherever we need to use it


my app--templateId

Copy after login

You can use c-event to bind events on components

The above is the detailed content of Detailed explanation of Cpage.js binding event instances to components. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!