Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case Analysis of jade Grammar

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this article, the editor introduces in detail the "jade Grammar case Analysis", with detailed content, clear steps and proper handling of details. I hope this "jade Grammar case Analysis" article can help you solve your doubts.

Label

Self-closing function pause = >

Input = = >

The writing of nested tags

P hello world, hello to the world.

Input

Hello world, hello to the world.

Large chunks of content appear in the tag

One: add "." after the label.

Script.

Console.log ("hello world")

Console.log ("hello world")

Second: add "|" before each paragraph

Script

| | console.log ("hello world") |

| | console.log ("hello world") |

Generate:

Console.log ("hello world")

Console.log ("hello world")

Property is divided by () a (href= "#") jump = = > jump

Single-line comment / H2 multiline comment / / H2 does not output comment / /-

Add a doctype html and you can output as

Set up id classname

# content defaults to div if it is not tagged

P#cont

A.btn

A#download.btn.btn-default

The output is as follows:

Code that is not buffered

-for (var itemo Bitteri

Hello world

P=hello world abc = = >

Hello world abc

Do not want to be translated:

Paired hello world abc = = >

Hello world abc

Use variables

-var name = "Dream_Mz"

P my name is # {name} = = >

My name is Dream_Mz

If you want to output # {}, you need to use "\" to translate.

-var name = ""

| | # {name} = > |

Do not want to translate:

|! {name} = = >

Tip: "|" is a pipe that can generally define a piece of text.

Cycle

Each val [, key] in OBJ val is the value key is the key (may not be written) obj is an object or array

# {key}: # {val}

-var name = {"key": 123,456 "key2", "key3": 789}

Each val,key in name

The value of h4 # {key} is # {val}

Case has the same function as switch in js.

-var apple = 1

Case apple

When 0

P you have no apple

When 1

P you have an apple

Default

P you have # {apple} apple

= = >

You have an apple

Writing method 2:

-var apple = 1

Case apple

When 0: p you have no apple

When 1: p you have an apple

Default: p you have # {apple} apple

Merge the value of when:

-var apple = 1

Case apple

When 0

When 1

P you have few apple

Default: p you have # {apple} apple

Output when the value of apple is 0amp 1

You have few apple

Output when the value of apple is not 0max 1

You have # {apple} apple

Support for mixin function

Mixin setName (name,age)

Ul

Li, my name is # {name}

Li, I am # {age} this year.

Ul

+ setName (Zhang San, 19)

Mixin with blocks

Mixin getInfo (name,age)

Ul

Li, this is # {name}.

Li I # {age} this year

If block

Block

Ul

+ getInfo ("Li Si", 18)

Li, I'm from China.

Li hello world

Accept external classes or properties

Mixin link (href,name)

A (classically classified attributes.classmativetitlewritten attributes.titlewritten hrefringhref). Btn1=name

+ link ("#", "abc") (class= "btn", title= "I am the button")

Abc

After reading this, the article "jade Grammar case Analysis" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report