小编Sho*_*ngs的帖子

在Vite2中,如何在tailwind.config.js中导入ESModule

构建 Vite2 应用程序。

试图导入一个ESModulein tailwind.config.js. 该模块的导出方式如下:

export default xxx;
Run Code Online (Sandbox Code Playgroud)

然后我导入了该模块,如下tailwind.config.js所示:

const xx = require('./xx/xxx');
Run Code Online (Sandbox Code Playgroud)

但我收到一个错误:

[plugin:vite:css] Cannot use import statement outside a module
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

javascript tailwind-css vite

17
推荐指数
1
解决办法
2万
查看次数

如何在 Vue3 中使用 TypeScript 为 ref(模板绑定)定义类型?

模板:

<tremplate>
  <div ref="element"></div>
</template>
Run Code Online (Sandbox Code Playgroud)

脚本:

export default {
  setup() {
    const elelemt = ref(null);
    return {
      element,
    };
  },
};
Run Code Online (Sandbox Code Playgroud)

这是在 vue3 中定义 ref 的正常方式,但以 JavaScript 方式。如果我使用的是 TypeScript,我需要为 value 定义一个类型element,对吗?

我该如何确保 value 的正确类型element

typescript vue.js vuejs3

12
推荐指数
4
解决办法
5912
查看次数

标签 统计

javascript ×1

tailwind-css ×1

typescript ×1

vite ×1

vue.js ×1

vuejs3 ×1