Magento2结帐表格:如何在字段中显示占位符属性值? [英] Magento2 checkout form: How to display placeholder attribute value in fields?
问题描述
早上好Stackoverflow,
Goodmorning Stackoverflow,
我正在自定义Magento 2中的结帐页面.现在,我试图在运输地址表单中显示占位符而不是标签,但到目前为止没有成功.我希望有人可以帮助我
I'm customizing the checkout onepage in Magento 2. Now I'm trying to display placeholders instead of labels in the shipping-address form, but no success till now. I hope someone can help me out
干杯,豪尔赫
更新:
在控制台中,我可以看到一个变量正在赋予元素输入的属性占位符.
In the console i can see a variable is giving to the attribute placeholder of the element input.
<input class="input-text" type="text" data-bind="
value: value,
valueUpdate: 'keyup',
hasFocus: focused,
attr: {
name: inputName,
placeholder: placeholder, // <<<< right here
'aria-describedby': noticeId,
id: uid,
disabled: disabled
}" name="street[0]" placeholder="" aria-describedby="notice-BVWUCFN" id="BVWUCFN">
现在,我想知道是否可以通过后端修改此变量,因此我可以在占位符attr中显示标签名称. 查看屏幕截图
Now i would like to know if theres is a way to modify this variable via the backend, so i can display label name in the placeholder attr. See screenshot
我的英语不好的策略
推荐答案
标准方式
从 vendor/magento/module-ui/view/frontend/web/templates/form/element/
复制所有html文件
在
app/design/frontend/<Vendor>/<theme>/Magento_Ui/web/templates/form/element/
Copy all html files from vendor/magento/module-ui/view/frontend/web/templates/form/element/
at
app/design/frontend/<Vendor>/<theme>/Magento_Ui/web/templates/form/element/
然后按照 Akis Verillis 所述,将所有的placeholder: placeholder
更改为placeholder: label
.
Then change all Change placeholder: placeholder
to placeholder: label
as mention by Akis Verillis.
现在,您需要通过以下代码部署静态文件:
php bin/magento setup:static-content:deploy
看看魔术.
注意: 如果您从github结帐,请尝试从
/app/code/Magento/Ui/view/base/web/templates/form/element/
这篇关于Magento2结帐表格:如何在字段中显示占位符属性值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!