我一直在做一个项目,我被困在这里了。
我在.vue使用Jade模板,我需要显示当前年份,但我无法做到这一点
<template lang='jade'>
// Footer
footer#footer.footer
.container
.row
.footer-wrapper
.col-md-6.col-sm-6.col-xs-12
.footer-brand
img(src='assets/images/logo-white.png', alt='logo')
.col-md-6.col-sm-6.col-xs-12
.copyright
p
a(href='https://www.easycryptocoins.info/') Easycryptos
script.
© 2018 - {{ new Date().getFullYear() }}
| . All rights reserved.
</template>
`我希望获得2018年的版权-(本年度),但我只能获得Easycryptos
发布于 2019-07-25 05:02:09
尝试在数据对象中创建一个名为'currentDate‘的属性,并在模板中使用它,如下所示:
data(){
return {
currentDate: new Date,
}
}在你的模板中这样做:
{{currentDate.getFullYear()}}你应该实例化一个对象来访问它的方法。
https://stackoverflow.com/questions/57191154
复制相似问题