当前位置:网站首页>v-if,v-else,v-for
v-if,v-else,v-for
2022-07-27 19:07:00 【qq_ forty-two million forty-two thousand one hundred and fifty-】
conditional
v-if,v-else Implement judgment
Code
<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>demo-02</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
</head>
<body>
<div id="app">
<p v-if="type==='A'">type yes A</p>
<p v-else-if="type==='B'">type yes B</p>
<p v-else>type yes C</p>
</div>
<script> var app = new Vue({
el: '#app', data: {
type: 'B' } }) </script>
</body>
</html>
Running results 
loop
From an array todos Each item taken out is todo
<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>demo-04</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
</head>
<body>
<div id="app">
<ol>
<li v-for="todo in todos">
{
{ todo.text }}
</li>
</ol>
</div>
<script> var app = new Vue({
el: '#app', data: {
todos: [ {
text: ' Study JavaScript' }, {
text: ' Study Vue' }, {
text: ' The whole cow project ' } ] } }) </script>
</body>
</html>
Running results 
边栏推荐
猜你喜欢

MySQL 01 关系型数据库设计

Typescript installation

Kinect for Unity3d----KinectManager

Unity learning notes (realize the conveyor belt)

MongoDB

Selenium自动化测试面试题全家桶

An article allows you to master threads and thread pools, and also solves thread safety problems. Are you sure you want to take a look?

Sentinel1.8.4 persistent Nacos configuration

图的遍历的定义以及深度优先搜索和广度优先搜索(二)

v-if,v-else,v-for
随机推荐
CMD 命令
Leetcode first day of question brushing
C # interaction with MySQL database - MySQL configuration and addition, deletion, query and modification operations
「测试新手百科」5 分钟快速上手Pytest 自动化测试框架
Led learning eye protection table lamp touch chip-dlt8t10s-jericho
Collection of software design suggestions of "high cohesion and low coupling"
Full automatic breast pump chip dltap703sd
express
Using functions to extract numbers from text strings in Excel
log4j. Properties log details
Intelligent insomnia therapeutic instrument product dlt8p68sa Jericho
The great idea of NS2
功率单位(power control)
An article allows you to master threads and thread pools, and also solves thread safety problems. Are you sure you want to take a look?
The great idea of NS2
WinForm screenshot save C code
Latex use - control the display position of tables or graphics
MySQL 03 advanced query (I)
MongoDB
win10小技巧(1)——转移桌面位置