当前位置:网站首页>数据/组件绑定的各种情况
数据/组件绑定的各种情况
2022-04-22 05:45:00 【礼礼。】

<template>
<div class="wrapper">
<!-- 数据绑定 -->
<text class="title">数据绑定:{
{
title }}</text>
<!-- 事件绑定 -->
<text @click="press" class="bt">事件绑定:{
{
click }}</text>
<!-- 列表渲染 -->
<div>
<!-- tid="uniqueId"表示使用数组list的数组元素$item.uniqueId作为数组元素的唯一 Id,且必须保证 uniqueId 这个属性值在每个数组元素都不一样。 -->
<div for="{
{list}}" tid="uniqueId">
<!-- <text>{
{
$idx}}</text> -->
<text>列表渲染{
{
$item.uniqueId }}</text>
</div>
</div>
<!-- 条件渲染 if-->
<div>
<text if="{
{display}}">Hello-1</text>
<text elif="{
{display}}">Hello-2</text>
<text else>条件渲染 if else</text>
</div>
<!-- 条件渲染 show-->
<text show="{
{visible}}">条件渲染 show</text>
<!-- 逻辑控制块 -->
<div>
<list class="ljk">
<text>逻辑块控制:</text>
<block for="cities">
<list-item type="city">
<text style="color:#faf8fc">{
{
$item.name }}</text>
</list-item>
<list-item type="spot" for="$item.spots">
<text>{
{
$item.address }}</text>
</list-item>
</block>
</list>
</div>
<!-- 引入自定义组件 -->
<div>
</div>
<!-- 动态组件 -->
<div>
</div>
<!-- 过滤组件 -->
<div>
<text>{
{
message | capitalize('11','22','33') }}</text>
</div>
</div>
</template>
<script>
export default {
data: {
title: "欢迎体验快应用",
click:'123456',
list: [
{
uniqueId: 1
},
{
uniqueId: 2
},
{
uniqueId: 3
},
{
uniqueId: 4
}
],
display: false,
visible: true,
cities: [
{
name: '北京',
spots: [
{
address: '北京市朝阳区'
}
]
},
{
name: '上海',
spots: [
{
address: '上海迪士尼乐园'
},
{
address: '上海博物馆'
},
{
address: '上海琉璃艺术博物馆'
},
{
address: '南京路步行街'
}
]
}
],
message: '过滤组件',
},
capitalize(value) {
if (!value) return ''
value = value.toString()
return value.charAt(0).toUpperCase() + value.slice(1)
},
props: [],
onInit() {
},
press(e) {
this.click = 'Hello'
}
}
</script>
<style>
.wrapper {
flex-direction: column;
}
.bt{
width: 100px;
height: 100px;
color: #0000ff;
}
.ljk{
background-color: #cccccc;
height: 160px;
}
</style>
版权声明
本文为[礼礼。]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45736311/article/details/123631235
边栏推荐
- 面试基础知识
- Daily learning record -- solving graphviz Chinese garbled code problem
- Swelling corrosion and other morphological treatment
- STM32 learning note 3 - input pin of GPIO
- 笔记:unordered_map的理解与使用
- The Localtime function affects performance
- Intel SGX thread lock
- deep learning object detection
- Setting time and date display of QT learning
- Characteristics and usage of QT signal and slot
猜你喜欢

关于常量指针、指针常量的使用--练习题(记录)

Geojson file and ShapeFile file single conversion gadget

DS18B20 of Blue Bridge Cup embedded expansion board learning

算数和逻辑操作

Interaction method I between STM32 single chip microcomputer and ld3320 voice module

面试基础知识

Part 84 leetcode sword refers to offer dynamic programming (I) Fibonacci sequence

Rtl8367 learning note 1 - Basics

IWDG

QT add PRI compile run: error: fatal error: no input files problem solving
随机推荐
Clock
TCP通讯MODBUS协议解析
判断完全二叉树
PyGame simple aircraft war
LLVM中的PHI节点
auto和decltype两种类型推断方式的区别(学习笔记)
汇编 dos中断功能
Single and multi-channel image contrast processing
高考志愿填报参考
Compiling OpenSSL of arm64 on M1 chip
Use of tab control control in MFC
Dynamic memory management, file operation, preprocessing
Part 85 leetcode sword refers to offer dynamic programming (II) frog jumping steps
halcon与opencv或者halcon配置修改包含目录、库目录继承值的问题
Blue Bridge Cup embedded expansion board learning nixie tube
VB operation, Excel format setting and printing page setting (Simplified)
STL学习笔记0x0001(容器分类)
Assemble makefile
写一个函数的声明,使其返回数组的引用并且该数组包含10个string对象(笔记)
qt 压缩文件夹