【问题标题】:captcha not rendering in vue.js laravel 5.6.7验证码未在 vue.js laravel 5.6.7 中呈现
【发布时间】:2023-03-14 12:10:02
【问题描述】:

我正在尝试将 recaptcha 合并到 vue.js 中,我也在使用 Laravel 5.6.7

用于验证码的 Vue 包

https://github.com/DanSnow/vue-recaptcha#install

刀片

<div class="col-md-8">
    <login></login>
</div>

app.js

import VueRecaptcha from 'vue-recaptcha';
Vue.use(VueRecaptcha);

Vue.component('login', require('./components/login.vue'));

vue.js 中的登录组件

<template>
    <div>
        <div class="form-group row">
            <div class="col-md-6">
                <div class="g-recaptcha" data-sitekey="My site key">
                </div>
            </div>
        </div>
    </div>
</template>

问题

我为验证码放置了 div,但它没有呈现任何内容。我错过了什么吗?

【问题讨论】:

    标签: vue.js laravel-5.5


    【解决方案1】:

    documentation 中所述,VueRecaptcha 已作为组件导入并添加到其中。

    import VueRecaptcha from 'vue-recaptcha';
    export default {
        ...
        components: { VueRecaptcha }
    };
    

    在模板中声明使用vue-recaptcha 标签。

    <vue-recaptcha sitekey="Your key here">
        <button>Click me</button>
    </vue-recaptcha>
    

    【讨论】:

    • 在哪里写这个export default {?在组件内部还是在 app.js 内部?
    • 基本上你可以写在你的Vue实例或者Vue.component('vue-recaptcha', VueRecaptcha);
    • 或者您可以尝试Vue.use(VueRecaptcha); 并使用vue-recaptcha 标签,如果它确实有效。
    • 你能在这里推荐吗? stackoverflow.com/questions/49364689/…
    猜你喜欢
    • 2018-08-19
    • 2013-09-16
    • 1970-01-01
    • 2017-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-05
    • 2018-08-09
    相关资源
    最近更新 更多