报错原因:文件没有export default来导出不存在默认的对象。
解决方法1:结构赋值。引入需要使用到的属性和方法。
import { toFixed } from './utils.js'
解决方法2:* as obj将所有导出属性和方法合并到一个对象中。
import * as base from './utils.js'
说明:vue3不能使用require,所以需要将require替换成import这种方式,防止报错。
报错原因:文件没有export default来导出不存在默认的对象。
解决方法1:结构赋值。引入需要使用到的属性和方法。
import { toFixed } from './utils.js'
解决方法2:* as obj将所有导出属性和方法合并到一个对象中。
import * as base from './utils.js'
说明:vue3不能使用require,所以需要将require替换成import这种方式,防止报错。