我可以在不需要的情况下使用Vue吗

Can I use Vue without require?

本文关键字:Vue 情况下 不需要 我可以      更新时间:2023-09-26

我只是在学习JS和Vue.JS,一开始不想有任何像NodeJS、npm等的开销。我想要一些简单的代码。

医生说我需要:Add vue and vue-resource to your package.json, then npm install, then add these lines in your code:

但我能简单地做吗:

var Vue = ('vue');
Vue.use('vue-resource');

或者喜欢它:

var App = new Vue ({
   el: '#app',
  data:
    {
      currentView: 'guestmenu'
    }
  })

Vue.use('vue-resource');

我正确地理解它是用vue-resource扩展Vue实例吗?

如果你只想玩Vue,而不必担心设置package.json文件,也许可以试试这样的东西?

<script type="text/javascript" src="lib/js/vue.min.js"></script>
<script type="text/javascript" src="lib/js/vue-resource.min.js"></script>

显然,您需要下载vue.min.js和vue-resource.min.js,并将它们放在HTML文件的相关目录中。