Liferay-React portlet:MIME类型('text / html')不可执行,并且启用了严格的MIME类型检查

时间:2018-08-21 14:03:36

标签: javascript reactjs liferay-7

我正在liferay 7中构建一个npm-react portlet,并且尝试使用https://react-table.js.org来呈现表数据。当我尝试使用浏览器访问portlet时,在以下屏幕截图中出现错误:

错误: enter image description here

MyJS文件:

import React from 'react';
import ReactDOM from 'react-dom';
import Clock from './components/Clock'
import ReactTable from "react-table";
import 'react-table/react-table.css'

function Mytable() {
    const data = [{
        name: 'Tanner Linsley',
        age: 26,
        friend: {
            name: 'Jason Maurer',
            age: 23,
        }
    }];

    const columns = [{
        Header: 'Name',
        accessor: 'name' // String-based value accessors!
    }, {
        Header: 'Age',
        accessor: 'age',
        Cell: props => <span className='number'>{props.value}</span> // Custom cell components!
    }, {
        id: 'friendName', // Required because our accessor is not a string
        Header: 'Friend Name',
        accessor: d => d.friend.name // Custom value accessors!
    }, {
        Header: props => <span>Friend Age</span>, // Custom header components!
        accessor: 'friend.age'
    }];

    return (<ReactTable
        data={data}
        columns={columns}
    />);
}

export default function (elementId) {
    console.log("default");
    ReactDOM.render(<Mytable/>, document.getElementById(elementId));
}

0 个答案:

没有答案