【发布时间】:2019-01-21 18:39:54
【问题描述】:
我似乎无法让库 hashids 与 vue.js 一起使用
我想如何使用它的首选方法是:
<template>
<div class="container">
{{ hashids.encode('1') }}
</div>
</template>
<script>
const Hashids = require("hashids")
export default {
data () {
return {
Hashids: Hashids,
}
},
}
</script>
【问题讨论】:
-
你试过
{{ Hashids.encode('1') }}?? -
感谢您的评论。刚试了一下。它返回错误“[Vue warn]: Error in render:”TypeError: _vm.Hashids.encode is not a function”
标签: javascript vue.js vuejs2 vue-component hashids