数据绑定写在标签script中,格式如下
<script>
export default{
data() {
return{
mes:"hello",
flag:false
}
}
}
</script>
插值表达式的demo
<template>
<view>
<view>数据绑定的学习</view>
<view>{{mes}}</view>
<view>{{"奥里给"+'你好'}}</view>
<view>{{2+2}}</view>
<view>{{flag?'我是真的':'我是假的'}}</view>
</view>
</template>
<script>
export default{
data() {
return{
mes:"hello",
flag:false
}
}
}
</script>
<style>
</style>
显示结果
其中数字+字符为字符格式