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

来源:3-1 一点小准备-单独讲解vue核心内容的配置

Junble

2021-03-29

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回答

Jokcy

2021-04-03

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

0
7
Jokcy
回复
Junble
啊这。。。不好意思之前没注意到回复,折叠了,解决了就好
2021-04-20
共7条回复

Vue核心技术 Vue+Vue-Router+Vuex+SSR实战精讲

深入讲解Vue核心技术,展示Vue应用开发中的各种问题和解决方案

3168 学习 · 853 问题

查看课程