.Verify.Verify__focus.Verify__titleV"> : Property 'text' was accessed during rendering but is not defined on the Pug instance-PHP Chinese Network Q&A
: Property 'text' was accessed during rendering but is not defined on the Pug instance
P粉598140294
P粉598140294 2024-03-27 16:15:26
0
1
253

I'm new to vue and am trying to create a view that uses code to verify an email after someone signs up. I currently only have views and nothing to connect to the email or generate code. I'm using pug, typescript and scss in this vue project. I know this problem is usually due to typos, but I can't find it. idea?

.vue file:

  

.ts file:

import { Ref } from "vue"; import { useApolloClient } from "@vue/apollo-composable"; import { ValidatedUser } from "@/models"; import { gql } from "graphql-tag"; const query = gql` query Verify($input: Verify) { Verify(input: $input) { __typename token user { email id } } } `; /** * Retrive apollo client and provide useVerify * function to validate input and execute Verify process. * * @param verificationCode - reactively wrapped email address of the user signing up. * @returns useVerify composition functionality. */ export default function useVerify(verificationCode: Ref): { verifyUser: () => Promise; } { const { resolveClient } = useApolloClient(); /** * Execute the Verify process for the given verification code. */ async function verifyUser(): Promise { if (verificationCode.value !== "123456") { return; } else{ console.log("worked"); //TODO: auth here } const client = resolveClient(); const variables = { input: { username: verificationCode.value }, }; const response = await client.query({ query, variables }); const validatedUser: ValidatedUser = response.data.Verify; console.log("USER:", validatedUser); console.log("verificationCode: ", variables); } return { verifyUser }; }

Thanks in advance!

P粉598140294
P粉598140294

reply all (1)
P粉043566314

It seems this line triggered an error in the template

.... .Verify__field va-input.Verify__textInput( type="text", name="verificationCode", placeholder="Verification Code", v-model="text", //

The reason is that you did not return a variable namedtextin the setting function

function setup() { const verificationCode = ref(""); const { verifyUser } = useVerify(verificationCode); return { verificationCode, verifyUser, //no text property here }; }

You may need to define text attributes like this

function setup() { const verificationCode = ref(""); const { verifyUser } = useVerify(verificationCode); const text = ref(""); return { verificationCode, verifyUser, text, }; }
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!