模板语法
变量赋值
<script>
export default {
data() {
return {
title: 'hello',
name: 'uni-app'
}
}
}
</script>
在视图中使用{ {}}调用变量
<template>
<view class="demo">
{
{
title}}--{
{
name}}
</view>
</template>
数组形式的数据绑定
<script>
export default {
data() {
return {
students:[
{
name:'张三',age:18},
{
name:'李四',age:20}
]
}
}
}
</script>
在视图中通过数组索引调用
<template>
<view class="demo">
{
{
students[0]