跟随按钮中的链接

时间:2018-11-08 20:57:45

标签: javascript vue.js vue-router

为大家加油。我在以下链接时遇到了问题。

我需要将链接分配给按钮。我可以将路由器链接包装在一个按钮中吗?

<template lang="html">
    <button @click="" v-if="status == 'SUCCESS'"><font-awesome-icon icon="check" /></button>
    <button @click="" v-else-if="status == 'CRASH'"><font-awesome-icon icon="times" /></button>
    <button @click="" v-else-if="status == 'NO_DATA'"><font-awesome-icon icon="minus" /></button>
    <button v-else>What?</button>
</template>

1 个答案:

答案 0 :(得分:0)

只需将def averages(table, col, by): columns = tuple(([table[i][col] for i in range(len(table))])) #Place col column into tuple so it can be placed into dictionary groupby = tuple(([table[i][by] for i in range(len(table))])) #Place groupby column into tuple so it can be placed into dictionary avgdict = {} avgdict[groupby] = [columns] newdict = {} for key in avgdict: for x in range(len(key)): if key[x] in newdict: newdict[key[x]] += avgdict[key][0][x] else: newdict[key[x]] = avgdict[key][0][x] print(newdict) 的值分配给您的按钮,它将变成一个有效的:to=""链接。

例如:

vue-router

将变成:

<button :to="{name: 'Home'}" />