我想在页脚中的年份每年自动更改,而无需手动操作,并将文本全部放在一起。例如[(c) 2022 MyWebsite版权所有]是否有一种方法与Wix Velo?这就是我所拥有的,但我一定是遗漏了什么。
文本字段id = #footerYear
w美元。onReady(function () {
let year = new Date();
w美元(# footerYear)
进入masterpage.js文件。你只能在这里编辑页脚和页眉代码。
$w.onReady(function () {
let now = new Date();
$w('#footerCopyrightText').text = `(C) ${now.getFullYear()} MyWebsite All rights Reserved`;
});
https://www.wix.com/velo/reference/$ w/文本/文本
好吧,我并不真正使用Wix Velo,但我很快得到开始的例子,它是,你可以选择与$w('#footerYear')
和改变它的值改变text
道具上的元素。请务必检查从Wix Velo开始
// in your onReady function
let date = new Date();
$w('#footerYear').text = date.getFullYear();