<v-card>-您是否正确注册了组件?

时间:2018-09-03 08:51:16

标签: vue.js vuetify.js

我是Vuetify和Vue.js的新手。

我尝试进行v卡布局,但失败了。

说实话,我复制粘贴此代码:

https://github.com/vuetifyjs/vuetifyjs.com/blob/master/src/examples/layouts/centered.vue

当我运行时出现错误:

vue.runtime.esm.js?2b0e:587 [Vue warn]: Unknown custom element: <v-card> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <Login> at src/views/Login.vue
       <VApp>
         <App> at src/App.vue
           <Root>
  

我已经安装了vuetify,但仍然出错。有解决方案吗?

已更新:

  

如果我导入vuetify,则会收到另一个错误:整个模块的导入   由于preventFullImport设置,不允许vuetify

1 个答案:

答案 0 :(得分:5)

如果您使用的是vue-cli-3,则可能在某个时候可以选择“点菜”还是完全导入。您可以使用它导入所需的组件,也可以删除“点菜”:

  • <?php if (isset($_POST['submit'])){ include_once 'db.php'; $first = mysqli_real_escape_string($conn,$_POST['first']); $last = mysqli_real_escape_string($conn,$_POST['last']); $uid = mysqli_real_escape_string($conn,$_POST['uid']); $dob = mysqli_real_escape_string($conn,$_POST['dob']); $email = mysqli_real_escape_string($conn,$_POST['email']); $mobile = mysqli_real_escape_string($conn, $_POST['m_number']); $pwd = mysqli_real_escape_string($conn,$_POST['pass']); $member =mysqli_real_escape_string($conn, $_POST['member']); $outlet = mysqli_real_escape_string($conn,$_POST['outlet']); //ERROR HANDLERS //CHECK FOR EMPTY FIELDS //if(empty($first)||empty($last)||empty($uid)||empty($dob)||empty($email)||empty($mobile)||empty($pwd)||empty($member)||empty($outlet)) //{ //header("Location:../index.php?signup=empty"); //exit(); //}else{ //check if input characters are valid //if(!preg_match("/^[a-zA-Z]*$/", $first)|| !preg_match("/^[a-zA-Z]*$/", $last)){ //header("Location:../signup.php?signup=invalid"); //exit(); //}else{ //check email if(!filter_var($email,FILTER_VALIDATE_EMAIL)){ echo "<script>alert('Invalid Email,please register again.')</script>"; echo "<script>window.open('../index.php','_self')</script>"; exit(); }else{ //check if username is same $sql = "SELECT * FROM users WHERE user_uid = '$uid'"; $result = mysqli_query ($conn,$sql); $resultCheck = mysqli_num_rows ($result); if ($resultCheck > 0) { echo "<script>alert('Username has been taken, please register again.')</script>"; echo "<script>window.open('../index.php','_self')</script>"; exit(); }else{ //Hashing pwd $hashedPwd = password_hash($pwd,PASSWORD_DEFAULT); //INSERT THE USER INTO THE DATABASE $sql = "INSERT INTO users (user_first,user_last,user_uid,user_dob,user_email,user_mobile,user_pwd,user_member,user_outlet) VALUES ('$first','$last','$uid','$dob','$email','$mobile','$hashedPwd','$member','$outlet');"; mysqli_query($conn,$sql); echo "<script>alert('You have been Registered Successfully, Please login from our main page')</script>"; echo "<script>window.open('../index.php','_self')</script>"; exit(); } } } else{ header("Location:../index.php"); exit(); } ?> 中的vcard组件导入:

    src/plugins/vuetify.js
  • 通过修改import Vue from "vue"; import { Vuetify, VApp, VCard, /* other imports ... */ } from "vuetify"; import "vuetify/src/stylus/app.styl"; Vue.use(Vuetify, { components: { VApp, VCard, /* other imports */ }, /* theme option */ }); 文件来删除“点菜”导入:

    /babel.config.js
相关问题