gpt4 book ai didi

javascript - 我收到此错误 : Property or method "auto_password" is not defined on the instance but referenced during render

转载 作者:行者123 更新时间:2023-11-28 03:51:43 24 4
gpt4 key购买 nike

我正在 Laravel View 中创建一个 Vue 片段,当用户选中复选框时,它将禁用文本字段。但是我在控制台中收到此错误:

[Vue warn]: Property or method "auto_password" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

以下是观点:

create.blade.php

@extends('layouts.manage')

@section('content')
<div class="flex-container">
<div class="columns m-t-10">
<div class="column">
<h1 class="title">Create New User</h1>
</div>

</div>
<hr class="m-t-0">
<div class="columns">
<div class="column">
<form action="{{route('users.store')}}" method="POST">
{{csrf_field()}}
<div class="field">
<label for="name" class="label">Name</label>
<p class="control">
<input type="text" class="input" name="name" id="name">
</p>
</div>

<div class="field">
<label for="email" class="label">Email:</label>
<p class="control is-expanded">
<input type="text" class="input" name="email" id="email">
</p>
</div>

<div class="field">
<label for="password" class="label">Password</label>
<p class="control">
<input type="text" class="input" name="password" id="password" v-if="!auto_password">

<b-checkbox name="auto_generate" class="m-t-15" v-model="auto_password">Auto Generate Password</b-checkbox>

</p>
</div>
<button class="button is-success">Create User</button>
</form>
</div>

</div>
</div>{{-- end of .flex-container --}}
@endsection

@section('scripts')
<script>
var app = new Vue({
el: '#app',
data: {
auto_password: true

},

})
</script>
@endsection

layouts.manage

<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>AdBlog - Management</title>

<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
@yield('styles')
</head>
<body>
@include('_includes.nav.main')
@include('_includes.nav.manage')

<div class ="management-area" id="app">
@yield('content')
</div>

<!-- Scripts -->
<script src="{{ asset('js/app.js') }}"></script>
@yield('scripts')
</body>
</html>

我在这里缺少什么?

最佳答案

从 Assets 中的 app.js 中删除这一部分:

var app = new Vue({
el: '#app',
data: {}
})

关于javascript - 我收到此错误 : Property or method "auto_password" is not defined on the instance but referenced during render,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47944603/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com