国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - Can vue not have the .vue suffix? I want to introduce it into old projects, what should I do?
迷茫
迷茫 2017-05-19 10:35:12
0
5
966

Can vue not have the .vue suffix? I want to introduce it into an old project. What should I do?

迷茫
迷茫

業(yè)精于勤,荒于嬉;行成于思,毀于隨。

reply all(5)
大家講道理

Old projects directly import vue.js files

<script src="https://unpkg.com/vue/dist/vue.js"></script>
為情所困

You can try html. But this does not conform to the syntax of vue, it will report an error

為情所困

.vue format is not the file that is ultimately introduced into the page. After being packaged by webpack, a normal js file will be generated. Just introduce this js file.

淡淡煙草味

Deploy the old project to v-cli, then reference the .vue component, and then package it with webpack

阿神

The first question is about the suffix.
The suffix has nothing to do with VUE. Vue is just a special text file, even if you use .abc.
This is all thanks to webpack. In the loaders configuration of webpack, you can give one or more loaders to the specified file. You can also think of these loaders as precompilation tools.

  module: {
    rules: [{
        test: /\.vue$/, // 這里指定 .vue 文件通過 vue-loader 解析,你可以指定任何類型的文件。
        loader: 'vue-loader',
        options: vueLoaderConfig
      }]
   }

Second question, vue small project is similar to the usage of third-party libraries

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>vue-demo</title>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
  </head>
  <body>
    <p id="app">
      {{ message }}
    </p>
  </body>

  <script>
    var app = new Vue({
      el: '#app',
      data: {
        message: 'Hello Vue!'
      }
    })
  </script>
</html>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template