Created
August 6, 2021 02:42
-
-
Save z1076/4fa2a0c2e19f7a6cc3a8682b03ae08da to your computer and use it in GitHub Desktop.
[Vue] #vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// vim: syntax=js | |
v-on:keyup="getProd" //绑定事件 | |
v-on:click="activite(item.id,$event,'activite')" | |
:pid="['p'+ item.id]" //拼接绑定数据 | |
// 条件渲染 | |
v-if="province_status" //province_status为true则显示元素 | |
<h1 v-if="ok">Yes</h1> | |
//用 v-else 添加一个 “else” 块: | |
<h1 v-if="ok">Yes</h1> | |
<h1 v-else>No</h1> | |
<template v-if="ok"> | |
<h1>Title</h1> | |
<p>Paragraph 1</p> | |
<p>Paragraph 2</p> | |
</template> | |
// 绑定样式 | |
:class="{ 'active': isActive }" | |
:class="{'active':isActive==-1}" | |
//绑定并判断多个 | |
:class="{ 'active': isActive, 'sort': isSort }" | |
// for | |
<ul id="example-1"> | |
<li v-for="item in items"> | |
{{ item.message }} | |
</li> | |
</ul> | |
<div v-for="(value, key) in object"> | |
{{ key }} : {{ value }} | |
</div> | |
<div> | |
<span v-for="n in 10">{{ n }}</span> | |
</div> | |
// 数据加载完再显示 | |
<template v-text="is_display"> | |
<small class="fz_12">@{{ mobile_area }} @{{ provider }}</small> | |
</template> | |
<div id="app" v-cloak ></div> | |
css: [v-cloak]{display: none;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment