我可以在没有 vue-cli 和 nodejs 的情况下在单个页面中使用 vue 吗? [英] Can I use vue in a single Page without vue-cli and nodejs?

查看:36
本文介绍了我可以在没有 vue-cli 和 nodejs 的情况下在单个页面中使用 vue 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有 hello.vue 并且我想在 index.html 中使用它但没有 vue-cli 和 nodejs.

If there is a hello.vue and I want to use it in index.html but there is not vue-cli and nodejs.

我知道如何使用 vue.js,但如果我有 hello.vue,我不知道如何使用 vue 的组件.

I do know how to use vue.js but do not know how to use the vue'scomponent if I have a hello.vue.

我不是说清楚了吗?请不要告诉我如何感谢你.

Do not I say it clearly? please do not tell me how to thank you.

如何使用?

推荐答案

是的.您只需要从 CDN 导入 Vue.

Yes. You just need to import Vue from CDN.

用于生产:

<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>

用于开发:(给你完整的警告和调试模式)

For development: (gives you full warnings and debug mode)

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

然后你可以添加一个 script 标签并创建一个 Vue 实例.

Then you can just add a script tag and create a Vue instance.

window.app = new Vue({
  el: "#app"
})

有关更多信息,请访问官方文档.

For more information visit the official documentation.

这篇关于我可以在没有 vue-cli 和 nodejs 的情况下在单个页面中使用 vue 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆