未检测到Vuejs

时间:2018-07-02 21:06:20

标签: php css html5 vue.js bootstrap-4

大家好,请帮忙!我的页面上未检测到Vue js。我不知道为什么。过去,我已经开发了很多vueapp,而且以前从未遇到过问题。我想知道引导js是否与vuejs冲突?我加载了页面,当我尝试使用chrome开发工具时,它说未检测到vuejs。烦死了!有什么想法吗?

 <?php ob_start(); session_start();
if (isset($_SESSION['activated'])) {
    $activated = $_SESSION['activated'];
  }

  if (isset($activated) && $activated == 0) {
    echo '<script type="text/javascript">';
    echo 'alert("Please activate your account before signing in. ");';
    echo 'window.location.href = "resendoptions.php?userName=' . $_SESSION[username] . '";';
    echo '</script>';
  }

  if (isset($_SESSION['success']) and $_SESSION['success'] == 1) {
    $success = 1;
  }
  else {
    $success = 0;
  }

?>
<html>
<head>
    <style>
        nav a{
            color: white
        }
        nav {background-color: #1c71b9; }
        .navbar-toggle{border: 3px solid white;}
        .icon-bar{background-color: white;}
        .navbar-brand:hover{background-color: white;
        color: #1c71b9;
        }
        body{margin-top: 50px;}
        h1, h2, h3, h4, h5, h6, p{
            -webkit-font-smoothing: antialiased;
            text-rendering: optimizeLegibility;
        }
        .row + .row{margin-top: 20px;}
        .itemHeading{font-weight: bold;}
        .icon{display: block; max-width: 100%; margin-top: 10px;}
        .descriptionHeading{margin-top: 20px; text-align: center;}
        .descriptionSection{background-color: lightgray;}
        .mainDescriptionHeading{text-align: center;}
        .descriptionParagraph{text-align: center;}
        .centerDescriptionButton{padding-bottom: 20px;}
        .first-slide video{width: 100%;}
        .second-slide video{width: 100%;}
        .third-slide video{width: 100%;}
        .first-slide{width: 100%;}
        .second-slide{width: 100%;}
        .third-slide{width: 100%;}
        #myCarousel{margin-top: 50px;}
        .card{width: 100%; margin-bottom: 30px; box-shadow: 0 0 5px; padding: 15px;}
        .card video{width:100%;}
        .card-title{font-weight: bold;}

        .error{color: red;}
          .success{color: green;}
          .tooltip {
            position: relative;
            display: inline-block;
            padding-right: 5px;
            font-size: 20px;
          }
          .tooltip .tooltiptext {
              visibility: hidden;
              width: 240px;
              background-color: red;
              color: white;
              text-align: center;
              border-radius: 6px;
              padding: 5px 0;
              font-size: 15px;
              /* Position the tooltip */
              position: absolute;
              z-index: 1;
              top: -5px;
              left: 105%;
          }

          .tooltip:hover .tooltiptext {
              visibility: visible;
          }
          blue{color: darkblue; background-color: darkblue;}

    </style>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <link href="https://fonts.googleapis.com/css?family=Raleway:400,700,800" rel="stylesheet">
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!--vuejs-->
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
</head>

<body>
    <div id="app">
 <nav class="navbar navbar-fixed-top">
    <div class="container">
     <div class="navbar-header">
       <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
         <span class="sr-only">Toggle Navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
         </button>
         <a class="navbar-brand" href="index.php">My Site</a>
        </div><!--end .navbar-header-->
        <div id="navbar" class="collapse navbar-collapse">
        <ul class="nav navbar-nav navbar-right">
            <li v-show="admin==1"><a href="adminMenu.php">Admin</a></li>
            <li><a href="#">Subscriptions</a></li>
            <li><a href="#">Templates</a></li>
            <li><a href="#">Stock</a></li>
            <li v-show="sesloggedin==0"><a href="#" data-toggle="modal" data-target="#loginModal">Login</a></li>
            <li v-show="sesloggedin==1"><a href="logout.php">Logout</a></li>
            <li><a href="#">Signup</a></li>
            </ul>
        </div><!--end #navbar-->
     </div><!--end container-->
    </nav>
     <div class="container">
      <div id="loginModal" class="modal fade" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">
            <!--modal header-->
                <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">X</button>
                <h2 class="modal-title">Login</h2>
                </div>
                <!--modal body-->
                <div class="modal-body">
                <form role="form">
                    <div class="form-group">
                        <label for="username">Username/Email</label>
                        <input v-on:click="error=0; loginsub=0;" v-model="userName" type="text" class="form-control" placeholder="Username/Email" id="username" name="userName">
                        <a href="#">Forgot Username</a>
                    </div>
                    <div class="form-group">
                        <label for="password">Password</label>
                    <input v-on:click="error=0; loginsub=0;" v-model="password" type="password" class="form-control" placeholder="Password" name="password" id="password">
                        <a href="#">Forgot Password</a>
                    </div>
                    <div v-show="error==1 || userName.length<=7 && loginsub==1 || password.length<=7 && loginsub==1"><small class="error">Username/Email or password was incorrect...Try again</small>
                    </div>
                    </form>
                </div>
                <!--modal footer-->
                <div class="modal-footer">
                <button v-on:click="submit();" class="btn btn-primary btn-block">Login</button>
                </div>
            </div>
            </div>
        </div>
        </div>
    </div>
        <script>
  var app = new Vue({
    el: '#app',
    data: {
      userName: '',
      password: '',
      success: '<?php echo $success;?>',
      error: '',
      showPopUp: '',
      loginsub: '',
      response: [],
      sesusername: '<?php if (isset($_SESSION['username'])) {echo $_SESSION['username'];}?>',
      sesemail: '<?php if (isset($_SESSION['email'])) { echo $_SESSION['email'];}?>',
      sesloggedin: '<?php if (isset($_SESSION['loggedin'])) {echo $_SESSION['loggedin'];}?>',
      sesfirstname: '<?php if (isset($_SESSION['firstname'])) {echo $_SESSION['firstname'];}?>',
      seslastname: '<?php if (isset($_SESSION['lastname'])) {echo $_SESSION['lastname'];}?>',
      sesphone: '<?php if (isset($_SESSION['phonenumber'])) {echo $_SESSION['phonenumber'];}?>',
      sescompanyname: '<?php  if (isset($_SESSION['companyname'])) {echo $_SESSION['companyname'];}?>',
      admin: '<?php if (isset($_SESSION['admin'])) {echo $_SESSION['admin'];}?>'
    },
    created: function() {
      this.showPopUp = "<?php if(isset($_GET['showLoginForm']) and $_GET['showLoginForm']==1){echo true;} else{echo false;}?>";
      this.loginsub = 0;
    },
    methods: {
      popUp: function() {
        this.showPopUp = !this.showPopUp;
      },
      submit: function() {
        this.loginsub = 1
        if (this.userName.length >= 8 && this.password.length >= 8) {
          var jsonString = JSON.stringify({
            userName: this.userName,
            password: this.password
          });
          $.ajax({
            url: "login.php",
            method: "POST",
            dataType: "JSON",
            data: jsonString,
            success: function(data) {
              var vueapp = this;
              vueapp.response = data;
              vueapp.error = data.error;
              if(data.showPopUp==false){
                  $('#loginModal').modal('hide');
              }
              if (data.success == 1) {
                window.location = window.location.href.split("?")[0];
              }
              console.log(data);
            }.bind(this)
          });
        }
      }
    }
  });
</script>

1 个答案:

答案 0 :(得分:0)

要使vue devtools正常工作,页面上应该至少有一个Vue实例。

由于您的数据存在转义问题。您的Vue实例永远不会创建

转换自

FROM `93868086.ga_sessions_*`

 sesusername: '<?php if (isset($_SESSION['username'])) {echo $_SESSION['username'];}?>',