简体   繁体   English

使用 Vue javascript 模块时导入

[英]Importing when using Vue javascript module

I'm using the vue.esm.browser.js module for Vue, which works without problems:我正在为 Vue 使用vue.esm.browser.js模块,它可以正常工作:

import Vue from 'vue.esm.browser.js';

I can't however find a way to import the reactive and isReactive functions.但是,我找不到导入reactiveisReactive函数的方法。 I've tried我试过了

import { reactive, isReactive } from 'vue.esm.browser.js';

but it doesn't work.但它不起作用。 I'd appreciate any help to get this working!我很感激任何帮助来完成这项工作!

You haven't mentioned Vue version or where this file is coming from, but note the syntax:您还没有提到 Vue 版本或此文件的来源,但请注意语法:

Vue 2 (esm.browser), has a dot: Vue 2 (esm.browser),有一个点:

vue.esm.browser.js

Vue 3 (esm-browser), has a dash: Vue 3 (esm-browser),有一个破折号:

vue.esm-browser.js

I am guessing you are using Vue 2, which also does not support those exports, reactive and isReactive .我猜你正在使用 Vue 2,它也不支持那些导出、 reactiveisReactive Use Vue 3 instead.请改用 Vue 3。

Here is a Vue 3 esm-browser CDN url:这是一个 Vue 3 esm-browser CDN 网址:

https://cdn.jsdelivr.net/npm/vue@next/dist/vue.esm-browser.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM