My mvvm framework V3 tutorial -- class name Switching

Source: Internet
Author: User

Class binding is used to add or delete class names

There are three forms

Data-class = "object": an object is an object in the VM. Its key name is the class name. The true or false values determine whether to delete or add the object.

Data-class-classname = "Boolean", classname is the name of the class to be processed, and the value is a Boolean value, used to determine whether to delete or add.

Data-class = "string", string is the name of the class you want to add.

 
<Style>. my-class {color: yellow; Background: orange ;}. your-class {Line-Height: 3; width: 200px; Height: 100px ;}. his-class {text-indent: 2em; font-size: 14px ;}. single {width: 200px; Height: 100px; Background: lightgreen ;} </style> <Div data-class = "classes"> add multiple class names </div> <Div data-class-single = "single"> Add only one class name </div>
Require ("aveon, ready", function ($) {var Vm = $. mvvm. render ({classes: {"My-class": True, "Your-class": True, "his-class": true}, "single ": true });})


Example Add multiple class names to add only one class name

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.