Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何将jQuery库导入Vue.js_Javascript_Vue.js - Fatal编程技术网

Javascript 如何将jQuery库导入Vue.js

Javascript 如何将jQuery库导入Vue.js,javascript,vue.js,Javascript,Vue.js,从一个HTML模板,我正在转换为VUEJS应用程序与Laravel 很像 有一个功能是拖放表 src="assets/js/jquery.dataTables.min.js"> src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"> 桌子就像 <table class="table exampleleft tble-dsg tables_u

从一个HTML模板,我正在转换为VUEJS应用程序与Laravel 很像 有一个功能是拖放表

 src="assets/js/jquery.dataTables.min.js">
 src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js">
桌子就像

                    <table class="table exampleleft tble-dsg tables_ui t_draggable sourcetable">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th>Lead Source</th>
                                <th>Value</th>
                                <th>&nbsp;</th>
                            </tr>
                        </thead>
                        <tbody class="t_sortable">
                            <tr>
                                <td>lOREM IPSUM</td>
                                <td>Website</td>
                                <td> $ 750,000.00</td>
                                <td> <div class="btn-group justify-content-center">

                            </div>
                        </div></td>
                            </tr>
                            </tbody>
                            <table>






$(document).ready(function() {
  var $tabs = $('.t_draggable')
  $("tbody.t_sortable").sortable({
    connectWith: ".t_sortable",
    //items: "> tr:not(:first)",
    appendTo: $tabs,
    helper:"clone",
    zIndex: 999990
  }).disableSelection();

  var $tab_items = $(".nav-tabs > li", $tabs).droppable({
    accept: ".t_sortable tr",
    hoverClass: "ui-state-hover",
    drop: function( event, ui ) { return false; }
  });
});
所以什么都没发生 如果有人能帮上忙,我们如何将Vue js中的Jquery库与Laravel一起使用呢


我非常感谢大家使用ProvidePlugin

将添加到
build/webpack.dev.conf.js
build/webpack.prod.conf.js
中的插件阵列中,以便jQuery对所有模块全局可用:

plugins: [


  new webpack.ProvidePlugin({
    $: 'jquery',
    jquery: 'jquery',
    'window.jQuery': 'jquery',
    jQuery: 'jquery'
  })
]
你需要跑步
npm安装jquery——保存

打开文件
build/webpack.base.conf.js
并添加
插件

加:

const webpack=require('webpack')


jquery可用,但该库未初始化且不工作。jquery似乎在Vusjs呈现之前已完成执行。尝试Vue.NextTick its使Dom就绪。我尝试使用=>jQuery(“#progress-1”).LineProgressbar({percentage:25});log('Vue很棒');this.msg='VUE很棒'; });如何添加自定义库并调用它们的函数?这个问题不重复。我问的是如何包括jQuery库而不是jQuery。
plugins: [


  new webpack.ProvidePlugin({
    $: 'jquery',
    jquery: 'jquery',
    'window.jQuery': 'jquery',
    jQuery: 'jquery'
  })
]
module.exports = {
  plugins: [
    new webpack.ProvidePlugin({
      $: 'jquery',
      jquery: 'jquery',
      'window.jQuery': 'jquery',
      jQuery: 'jquery'
    })
  ]
  ...
}