请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

使用template.html,页面打开后写在head里面的内容变到body里面去了

config里面这样配置

new HTMLPlugin({
        template: path.join(__dirname,'template.html')
    })

template.html内容

<!DOCTYPE html>
<html lang="en">
<head>
  <mate charset="UTF-8"></mate>
  <mate name="viewport" content="width=device-width, initial-scale=1.0"></mate>
  <mate http-equiv="X-UA-Compatible" content="ie=edge"></mate>
  <title>Document</title>
</head>

<body>
  <div id="root"></div>
</body>

</html>

index.js

import Vue from 'vue'

new Vue({
  el: '#root',
  template: '<div> this is content</div>'
})

页面打开后写在head里面的内容变到body里面去了,是什么原因
图片描述
图片描述

正在回答

1回答

你看一下chrome调试工具的network模块,看看返回的HTML是什么内容

0 回复 有任何疑惑可以回复我~
  • 提问者 Junble #1
    <html lang="zh-cn">
    <head>
      <mate charset="UTF-8"></mate>
      <mate name="viewport" content="width=device-width, initial-scale=1.0"></mate>
      <mate http-equiv="X-UA-Compatible" content="ie=edge"></mate>
      <title>Document</title>
    <script defer src="bundle.56525bb8.js"></script></head>
    
    <body>
      <div id="root"></div>
    </body>
    
    </html>
    回复 有任何疑惑可以回复我~ 2021-04-07 10:29:56
  • 提问者 Junble #2
    截图更新到问题里面了
    回复 有任何疑惑可以回复我~ 2021-04-07 10:33:11
  • Jokcy 回复 提问者 Junble #3
    请求返回html是正常的,那应该是前端渲染的时候出现了问题。你把代码提到github上给我个地址吧,这么看我看不出问题
    回复 有任何疑惑可以回复我~ 2021-04-07 21:58:15
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号