如何在codeigniter中实现react js

时间:2017-03-22 07:56:12

标签: reactjs codeigniter-2

我可以在codeigniter中实现react.js 我试过,但如果我加载file.js有一个403,我在react.js新 有人可以帮助我

这是我的结构文件,如果我加载header.js我看到错误403访问被拒绝:

enter image description here

这是我的header.php文件



<div class = "tes">
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script>
<script src="<?php echo base_url('application/views/template/header.js');?>"></script>
&#13;
&#13;
&#13;

和我的header.js文件

&#13;
&#13;
'use strict';

function formatName(user) {
  return user.firstName + ' ' + user.lastName;
}

var user = {
  firstName: 'Harper',
  lastName: 'Perez'
};

var element = React.createElement(
  'div',
  { 'class': 'navbar-container ace-save-state', id: 'navbar-container' },
  React.createElement(
    'button',
    { type: 'button', 'class': 'navbar-toggle menu-toggler pull-left', id: 'menu-toggler', 'data-target': '#sidebar' },
    React.createElement(
      'span',
      { 'class': 'sr-only' },
      'Toggle sidebar'
    ),
    React.createElement('span', { 'class': 'icon-bar' }),
    React.createElement('span', { 'class': 'icon-bar' }),
    React.createElement('span', { 'class': 'icon-bar' })
  ),
  React.createElement(
    'div',
    { 'class': 'navbar-header pull-left' },
    React.createElement(
      'a',
      { href: '<?php echo site_url(\'dashboard\');?>', 'class': 'navbar-brand' },
      React.createElement(
        'small',
        null,
        React.createElement('i', { 'class': 'fa fa-briefcase' })
      )
    )
  ),
  React.createElement(
    'div',
    { 'class': 'navbar-buttons navbar-header pull-right', role: 'navigation' },
    React.createElement(
      'ul',
      { 'class': 'nav ace-nav' },
      React.createElement(
        'li',
        { 'class': 'light-blue dropdown-modal' },
        React.createElement(
          'a',
          { 'data-toggle': 'dropdown', href: '#', 'class': 'dropdown-toggle' },
          React.createElement('img', { 'class': 'nav-user-photo', src: '' }),
          React.createElement(
            'span',
            { 'class': 'user-info' },
            React.createElement(
              'small',
              null,
              'Welcome,'
            )
          ),
          React.createElement('i', { 'class': 'ace-icon fa fa-caret-down' })
        ),
        React.createElement(
          'ul',
          { 'class': 'user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close' },
          React.createElement(
            'li',
            null,
            React.createElement(
              'a',
              { href: '#' },
              React.createElement('i', { 'class': 'ace-icon fa fa-cog' }),
              'Settings'
            )
          ),
          React.createElement(
            'li',
            null,
            React.createElement(
              'a',
              { href: 'profile.html' },
              React.createElement('i', { 'class': 'ace-icon fa fa-user' }),
              'Profile'
            )
          ),
          React.createElement('li', { 'class': 'divider' }),
          React.createElement(
            'li',
            null,
            React.createElement(
              'a',
              { href: '<?php echo site_url(\'login/logout\');?>' },
              React.createElement('i', { 'class': 'ace-icon fa fa-power-off' }),
              'Logout'
            )
          )
        )
      )
    )
  )
);

ReactDOM.render(element, document.getElementById('tes'));
&#13;
&#13;
&#13;

抱歉我的英文不好

0 个答案:

没有答案