boostf 4 datetimepicker以symfony形式

问题描述

我使用jquery-ui datetimepicker作为日期时间输入使用boostrap4以symfony 5.1形式进行尝试,但在控制台错误Uncaught TypeError: $(...).datepicker is not a function中使用。在模板中,我有

<link rel="stylesheet" href=https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZonixN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">

在我拥有封闭身体之前

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="{{ asset('js/admin.js') }}"></script>

在admin.js中,我拥有

$(document).ready(function () {

    $( "#new_application_date" ).datepicker({dateFormat: 'dd.mm.yy'});

});

出什么问题了?

解决方法

问题出在使用jQuery slim,这一定是

<script src="https://code.jquery.com/jquery-3.5.1.min.js">