我正在浏览器中尝试初始化Vuetify,我相信它曾经可以工作,但现在失败了...
//In Node
app.use(serve("./node_modules/vuetify/dist"));
// On Client
<script type="module">
import * as Vuetify from '/vuetify/vuetify.js';
const global = window || global;
global.Vuetify = Vuetify;
Vue.use(Vuetify, {
...
});
</script>
当我跑步时我得到
Error in beforeCreate hook: "Error: Vuetify is not properly initialized, see https://vuetifyjs.com/getting-started/quick-start#bootstrapping-the-vuetify-object"
我尝试更改为...
//In Node
app.use(serve("./node_modules/vuetify"));
// On Client
<script type="module">
import Vuetify from "/vuetify/lib";
const global = window || global;
global.Vuetify = Vuetify;
Vue.use(Vuetify, {
...
});
</script>
但是这次还是失败
GET https://localhost:3001/vuetify/lib net::ERR_ABORTED 404
我什至尝试更改为...
//In Node
app.use(serve("./node_modules/vuetify"));
// On Client
<script type="module">
import Vuetify from "/vuetify/lib/index.js";
const global = window || global;
global.Vuetify = Vuetify;
Vue.use(Vuetify, {
...
});
</script>
然后我得到...
GET https://localhost:3001/vuetify/lib/components net::ERR_ABORTED 404
我认为js文件不是正确的ES6定义(即,没有扩展名mjs,cjs),但是有办法使其工作吗?
对于其他情况,这就是我加载Vue的方式
import Vue from '/vue/vue.esm.browser.js'
const global = window || global;
global.Vue = Vue;
这很好
答案 0 :(得分:0)
您可以尝试将脚本导入脚本标签中:https://cdnjs.com/libraries/vuetify
我认为您想要的链接是这样的:https://cdnjs.cloudflare.com/ajax/libs/vuetify/2.0.17/vuetify.js