我正在尝试建立一个基本的模块化程序,但是我似乎遇到了导入模块的问题.我尝试导入我的自定义模块,我收到以下错误:
(function (exports, require, module, __filename, __dirname) { import testStep from 'testStep';
^^^^^^
SyntaxError: Unexpected token import
Run Code Online (Sandbox Code Playgroud)
导致问题的代码:
testcase.js
import testStep from 'testStep';
testStep.hello();
Run Code Online (Sandbox Code Playgroud)
testStep.js
var testStep = {
hello: hello,
};
var hello = () => {
console.log('hello world');
};
export default {testStep};
Run Code Online (Sandbox Code Playgroud)
的package.json
{
"name": "rebuild-poc",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.6.0"
},
"dependencies": {}
} …
Run Code Online (Sandbox Code Playgroud) 当我点击父行时,我试图让几行折叠.目前,我只能折叠一行,但我需要能够同时关闭+2行.
下面是我当前的代码,在这段代码中,当我点击第一行时,我无法弄清楚如何折叠"HIDDEN"和"HIDDEN 2"行.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">
<style>
.hiddenRow {
padding: 0 !important;
}
</style>
<div id="accordion" role="tablist" aria-multiselectable="true">
<table class="table">
<tr id="main" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<td>
test
</td>
</tr>
<tr>
<td class="hiddenRow">
<div id="collapseOne" class="collapse in" aria-labelledby="headingOne">HIDDEN</div>
</td>
</tr>
<tr>
<td class="hiddenRow">
<div id="collapseTwo" class="collapse in" aria-labelledby="headingTwo">HIDDEN 2</div>
</td>
</tr>
</table>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js" integrity="sha384-BLiI7JTZm+JWlgKa0M0kGRpJbF2J8q+qreVrKBC47e3K6BW78kGLrCkeRX6I9RoK" crossorigin="anonymous"></script>
Run Code Online (Sandbox Code Playgroud)