Can vue declare a variable in the {{}} template for later use?

solution:

defines a temporary variable, but it needs to be hidden, otherwise it will be displayed

    <span v-show="false">
        {{message = chat.messages[chat.messages.length-1]}}
    </span>
    {{message.content}}

similar to Java"s jsp

<c:set var="salary" scope="session" value="${2000*2}"/>

now the code
.filteredValue [0]). Sex}


{{(gameDetail = scope.row.gameList.find(item=>item.gameId === scope.column.filteredValue[0]), void 0)}}
{{gameDetail.name}}
{{gameDetail.age}}
{{gameDetail.sex}}

preprocess gamelist with computed


effect:
image.png

Code:

<div v-bind:msg="msg= ''">{{msg}}</div>
<div>{{msg}}</div>
<div v-bind:msg="msg= ''">{{msg}}</div>
<div>{{msg}}</div>

this is also possible:

<div :key="msg= ''">{{msg}}</div>
<div>{{msg}}</div>
<div :key="msg= ''">{{msg}}</div>
<div>{{msg}}</div>

write it to computed


more interesting questions, if not lame, borrow v-for to deal with 1 loop hold variables.


        {{gameDetail.name}}
        {{gameDetail.age}}
        {{gameDetail.sex}}
    </span>
</template>
<template v-else>--</template>
Menu