Answers:
如果您尝试仅在phtml文件中添加图像路径,则应遵循以下方法,
<img src="<?php echo $block->getViewFileUrl('images/image.png') ?>">\
要使用淘汰赛方法:
尝试从* .phtml文件向窗口添加变量:
<script>
  window.imgpath = '<?php echo $block->getViewFileUrl('images/image.png') ?>';
  </script>
并从窗口读取该变量:
  function someFunction() {
  var imgPath = window.imgpath;
  }
更改您的图片代码:
<img alt="" data-bind="attr: { src: someFunction() } "/>
              在phtml中创建js变量
<script>
  var imgpath = '<?php echo $block->getViewFileUrl('images/image.png') ?>';
</script>
现在创建新的js函数
getImagepaypal: function() {
                return window.imgpath;
            }
在你的HTML文件
 <img alt="" data-bind="attr: { src: getImagepaypal() } "/>
              您可以在每个magento需要js文件的地方使用此文件,而无需任何要求-它来自vendor / magento / module-theme / view / frontend / templates / page / js / require_js.phtml
require.s.contexts ._。config.baseUrl
<img data-bind="attr: { src: require.toUrl('')+'images/icon-paypal.png' }" alt="">。