Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 水平排列<;th>;带有节点和把手的桌子标签_Mysql_Node.js_Handlebars.js - Fatal编程技术网

Mysql 水平排列<;th>;带有节点和把手的桌子标签

Mysql 水平排列<;th>;带有节点和把手的桌子标签,mysql,node.js,handlebars.js,Mysql,Node.js,Handlebars.js,怎么样,我试着咨询一下NodeJs、Mysql和handlebar。 查询的结果我没有问题。 BD中的表格如下所示 水果桌 Id fruit 1 Apple 2 Mango 3 Strawberry 进行查询的文件 水果.js router.get('/', isLoggedIn, async (req, res) => { const fruitAll = await db.query('SELECT * FROM fruit ’); res.r

怎么样,我试着咨询一下NodeJs、Mysql和handlebar。 查询的结果我没有问题。 BD中的表格如下所示

水果桌

Id    fruit
1     Apple
2     Mango
3     Strawberry
进行查询的文件

水果.js

router.get('/', isLoggedIn, async (req, res) => {

  const fruitAll = await db.query('SELECT  * FROM fruit ’);

res.render(‘fruit’, {fruitAll});
});
我执行视图的文件如下所示

List.hbs

{{#each fruitAll}}
<div class="container p-4">
  <table border="1">
    <tr>
      <th>{{fruit}}</th>
    </tr>
    <tr>
      <th>Example 1</th>
      <th>Example 2</th>
      <th>Example 3</th>
    </tr>
  </table>
</div>
{{/each}}
我想要的是如何水平放置水果。我的意思是这样

______________________________
|Apple   |Mango   | Strawberry|
_______________________________
|Example1|Example2| Example3  |
–––––––––––––––––––––––––––––––
它将是:

<div class="container p-4">
  <table border="1">
    <tr>
     {{#each fruitAll}}
      <th>{{fruit}}</th>
      {{/each}}
    </tr>
    <tr>
      <th>Example 1</th>
      <th>Example 2</th>
      <th>Example 3</th>
    </tr>
  </table>
</div>

{{{#每个水果}
{{水果}
{{/每个}}
例1
例2
例3
因为您需要更多的
th
标记。在您的情况下,
将被复制
furtall.length
(在本例中为3)次

<div class="container p-4">
  <table border="1">
    <tr>
     {{#each fruitAll}}
      <th>{{fruit}}</th>
      {{/each}}
    </tr>
    <tr>
      <th>Example 1</th>
      <th>Example 2</th>
      <th>Example 3</th>
    </tr>
  </table>
</div>