我正在开发一个简单的javascript模块用于学习目的。它看起来如下:
function gen (props) {
var test = [];
for(var i = 0; i < 10; i++) {
test.push(props.start + i);
}
return test;
}
module.exports = function (props) {
return gen(props)
}
我将此模块称为:
<script>
import gen from './gen.js'
...
mounted: function () {
var x = gen({start: 5});
console.log(x);
}
...
</script>
但我收到Converting circular structure to JSON
错误。我做错了什么?