在没有 CDN 的 Wordpress 插件中包含 Vue.js 组件 [英] Include Vue.js component in Wordpress plugin without CDN

查看:30
本文介绍了在没有 CDN 的 Wordpress 插件中包含 Vue.js 组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点习惯使用 Vue-cli 开发 Vue.js 单页应用程序.这一次,我想要一些不同的东西:使用 Vue.js(地图上的数据可视化)开发一个组件并将其包含在 Wordpress 中.

I am a bit used to develop Vue.js Single page application using Vue-cli. This time, I want something a different: develop a component with Vue.js (data visualisation on a map) and include it in Wordpress.

我找到了关于如何做到这一点的教程:https://deliciousbrains.com/vue-2-wordpress-plugin-tutorial/ 看起来很合适.但它通过 CDN 使用 Vue.js.

I found this tutorial on how to do that : https://deliciousbrains.com/vue-2-wordpress-plugin-tutorial/ and it seems pretty spot on. But it uses Vue.js via a CDN.

是否有技术解决方案可以在不使用 CDN 的情况下做同样的事情?以更通用的方式,将模块化 Vue.js 组件包含到 Wordpress 插件中的技术解决方案是什么?

Are there technical solutions to do the same thing without using a CDN ? In a more generic manner, what are the technical solutions to include a modular Vue.js component into a Wordpress plugin ?

推荐答案

你可以像以前一样使用 vue-cli,然后简单地在 wordpress 而不是 CDN 中调用你的 build.js 文件,使用 wordpress 函数:

You can use vue-cli as you're used to, and then simply call your build.js file in wordpress instead of CDN, using the wordpress function:

wp_enqueue_script()

这篇关于在没有 CDN 的 Wordpress 插件中包含 Vue.js 组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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