Vue中引入jquery bootstarp bootstarp-table (vue 2.0)

Vue中引入jquery bootstarp bootstarp-table (vue 2.0)

今天用vue-cli总是重复搭建环境,由于老年人的记忆里,总是记不住简单的细节,此为记录,好记性不如烂笔头!
在这里插入图片描述

如图所示,要想使用 jquery bootstarp bootstarp-table 就需要按顺序引入

jquery > bootstarp > bootstarp-table
//路径可能会有变动 最好在node_modules 中看看

import $ from 'jquery'
import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.min.js'
import 'bootstrap-table/dist/bootstrap-table.min.css'
import 'bootstrap-table/dist/bootstrap-table.min.js'
import 'bootstrap-table/dist/locale/bootstrap-table-zh-CN.min.js'

mian.js 入口文件引用前,当然要有依赖啦!

注意事项:要在当前项目文件夹下下载安装

npm install  jquery --save--dev
npm install bootstrap@3 --save--dev
npm install bootstrap-table@1.11.1 --save--dev
npm install --save popper.js      //这个为第三方依赖 

修改webpack.base.conf.js文件配置

1.加入

	var webpack = require('webpack');

2.在module.exports里输入:

		plugins: [
		    new webpack.ProvidePlugin({
		      $: "jquery",
		      jQuery: "jquery"
		    })
		   ]

在这里插入图片描述
在这里插入图片描述

最后

运行 npm run dev 就可以正常启动了 哈哈哈 .完美

推荐检测方法
一. 检测jquery

			$(function () {  
			    alert(123);  
			 });

页面弹出123,就说明第一步是没有问题的
二.检测 bootstrap

<div class="btn-group" role="group" aria-label="...">  
      <button type="button" class="btn btn-default">Left</button>  
      <button type="button" class="btn btn-default">Middle</button>  
      <button type="button" class="btn btn-default">Right</button>  
    </div>

按钮拥有样式,就说明这步也是没有问题的

三.检测bootstarp-table

//html
<table id="table" ></table>
//js
$("#table").bootstrapTable({})

因为没有配置跟数据 生成效果 (如图)
在这里插入图片描述
这样 就是一切完美 ,然后就可以配置使用 bootstrap-table

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

扶摇的星河

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值