GVKun编程网logo

Bootstrap源码之旅-mixins解读(1)(bootstrap源码下载)

24

如果您对Bootstrap源码之旅-mixins解读(1)和bootstrap源码下载感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解Bootstrap源码之旅-mixins解读(1)的各种细节

如果您对Bootstrap源码之旅-mixins解读(1)bootstrap源码下载感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解Bootstrap源码之旅-mixins解读(1)的各种细节,并对bootstrap源码下载进行深入的分析,此外还有关于bootstrap + bootstrap-table + jquery + bootstrap-paginator、Bootstrap 3.1如何使用mixin make-grid-columns()?、Bootstrap&LESS:仅作为参考导入mixins、bootstrap-4 – Bootstrap 4:如何在没有jQuery / minimal bootstrap.js的情况下使用NavBars?的实用技巧。

本文目录一览:

Bootstrap源码之旅-mixins解读(1)(bootstrap源码下载)

Bootstrap源码之旅-mixins解读(1)(bootstrap源码下载)

总结

以上是小编为你收集整理的Bootstrap源码之旅-mixins解读(1)全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

bootstrap + bootstrap-table + jquery + bootstrap-paginator

bootstrap + bootstrap-table + jquery + bootstrap-paginator

 

http://127.0.0.1:8848/pangBo/index.html

 

 

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
		 crossorigin="anonymous">
		<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
		 crossorigin="anonymous"></script>
		<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.1/bootstrap-table.min.css">
		<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.1/bootstrap-table.min.js"></script>
		<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.1/locale/bootstrap-table-zh-CN.min.js"></script>
		<script src="js/bootstrap-paginator.min.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div>
			<formrole="search">
				<div>
					<div>
						<div>
							<label>客户编号: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
						<div>
							<label>客户姓名: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
						<div>
							<label>手机号码: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
					</div>
					<div>
						<div>
							<label>客户编号: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
						<div>
							<label>客户编号: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
						<div>
							<label>客户编号: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
					</div>
					<div>
						<button type="submit">查询</button>
					</div>
				</div>
			</form>
		</div>
		<div>
			<divrole="group" aria-label="...">
				<button type="button" id="btn-one">可撤单</button>
				<button type="button" id="btn-two">已撤单</button>
			</div>
		</div>
		<div id="table-one">
			<table id="table"></table>
			<div>
				<div id="example">
					<ul id="pageLimit"></ul>
				</div>
			</div>
		</div>
		<div id="table-two">
			<table id="table-ta-one"></table>
			<div>
				<div id="example-two">
					<ul id="pageLimit-two"></ul>
				</div>
			</div>
		</div>
		<divid="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div>
				<div>
					<div>
						<button type="button"data-dismiss="modal" aria-hidden="true">&times;</button>
						<divid="myModalLabel">请输入登录密码:</div>
					</div>
					<div>
						<div>
							<input id="input-text" type="text" value=""placeholder="">
						</div>
						<button type="button" id="btn-ok">确定撤单</button>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
<script type="text/javascript">
	function operateFormatter(value, row, index) {
		return [
			''<button type="button"data-toggle="modal" data-target="#myModal">撤单</button>''
		].join('''');
	}
	window.operateEvents = {
		''click .RoleOfdelete'': function(e, value, row, index) {
			console.log(''kkk'');
		}
	};
	$(''#table'').bootstrapTable({
		url: '''', //请求后台的URL(*)
		method: ''GET'', //请求方式(*)
		// toolbar: ''#toolbar'', //工具按钮用哪个容器
		cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
		pagination: false, //是否显示分页(*)
		// pageSize: 10, //每页的记录行数(*)
		// pageNumber: 1, //初始化加载第一页,默认第一页,并记录
		// sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
		uniqueId: "id", //每一行的唯一标识,一般为主键列
		columns: [{
				field: ''id'',
				align: ''center'',
				title: ''交易合同号''
			},
			{
				field: ''ida'',
				align: ''center'',
				title: ''客户编号''
			},
			{
				field: ''idb'',
				align: ''center'',
				title: ''客户姓名''
			},
			{
				field: ''idc'',
				align: ''center'',
				title: ''手机号码''
			},
			{
				field: ''idd'',
				align: ''center'',
				title: ''证件号码''
			},
			{
				field: ''ide'',
				align: ''center'',
				title: ''产品代码''
			},
			{
				field: ''idf'',
				align: ''center'',
				title: ''产品名称''
			},
			{
				field: ''idg'',
				align: ''center'',
				title: ''购买金额''
			},
			{
				field: ''idh'',
				align: ''center'',
				title: ''交易时间''
			},
			{
				field: ''idi'',
				align: ''center'',
				title: ''撤单'',
				events: operateEvents,
				formatter: operateFormatter
			},
		],
		data: [{
				id: 1
			},
			{
				id: 1
			},
			{
				id: 1
			}
		],
		onLoadError: function() {
			showTips("数据加载失败!");
		},

	});
	$(''#table-ta-one'').bootstrapTable({
		url: '''', //请求后台的URL(*)
		method: ''GET'', //请求方式(*)
		// toolbar: ''#toolbar'', //工具按钮用哪个容器
		cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
		pagination: false, //是否显示分页(*)
		// pageSize: 10, //每页的记录行数(*)
		// pageNumber: 1, //初始化加载第一页,默认第一页,并记录
		// sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
		uniqueId: "id", //每一行的唯一标识,一般为主键列
		columns: [{
				field: ''id'',
				align: ''center'',
				title: ''交易合同号''
			},
			{
				field: ''ida'',
				align: ''center'',
				title: ''客户编号''
			},
			{
				field: ''idb'',
				align: ''center'',
				title: ''客户姓名''
			},
			{
				field: ''idc'',
				align: ''center'',
				title: ''手机号码''
			},
			{
				field: ''idd'',
				align: ''center'',
				title: ''证件号码''
			},
			{
				field: ''ide'',
				align: ''center'',
				title: ''产品代码''
			},
			{
				field: ''idf'',
				align: ''center'',
				title: ''产品名称''
			},
			{
				field: ''idg'',
				align: ''center'',
				title: ''购买金额''
			},
			{
				field: ''idh'',
				align: ''center'',
				title: ''交易时间''
			}
		],
		data: [{
				id: 1
			},
			{
				id: 1
			},
			{
				id: 1
			}
		],
		onLoadError: function() {
			showTips("数据加载失败!");
		},

	});
	$(''#btn-one'').click(function() {
		console.log(''kk'');
		$(''#table-one'').show();
		$(''#table-two'').hide();
		$(''#btn-one'').css({
			''background-color'': ''#e6e6e6''
		})
	})
	$(''#btn-two'').click(function() {
		console.log(''kkk'');
		$(''#table-two'').show();
		$(''#table-one'').hide();
		$(''#btn-one'').css({
			''background-color'': ''#FFF''
		})
	})
	$(''#pageLimit'').bootstrapPaginator({
		currentPage: 1, //当前的请求页面。
		totalPages: 100, //一共多少页。
		size: "normal", //应该是页眉的大小。
		bootstrapMajorVersion: 3, //bootstrap的版本要求。
		alignment: "right",
		numberOfPages: 5, //一页列出多少数据。
		itemTexts: function(type, page, current) { //如下的代码是将页眉显示的中文显示我们自定义的中文。
			switch (type) {
				case "first":
					return "首页";
				case "prev":
					return "上一页";
				case "next":
					return "下一页";
				case "last":
					return "末页";
				case "page":
					return page;
			}
		}
	});
	$(''#pageLimit-two'').bootstrapPaginator({
		currentPage: 1, //当前的请求页面。
		totalPages: 100, //一共多少页。
		size: "normal", //应该是页眉的大小。
		bootstrapMajorVersion: 3, //bootstrap的版本要求。
		alignment: "right",
		numberOfPages: 5, //一页列出多少数据。
		itemTexts: function(type, page, current) { //如下的代码是将页眉显示的中文显示我们自定义的中文。
			switch (type) {
				case "first":
					return "首页";
				case "prev":
					return "上一页";
				case "next":
					return "下一页";
				case "last":
					return "末页";
				case "page":
					return page;
			}
		}
	});
	$(''#btn-ok'').click(function() {
		var inputContent = $(''#input-text'').val();
		if (inputContent == '''') {
			alert(''密码不能为空 !'');
		}
		console.log(inputContent);
	})
</script>

 

Bootstrap 3.1如何使用mixin make-grid-columns()?

Bootstrap 3.1如何使用mixin make-grid-columns()?

我过去使用Bootstrap 3.0,并从我自己的bootstrap较少的文件编译我的css少一些。

在这些我的类采用一些引导风格,像这样:

.myClass{
    .col-md-3;
    border: 1px solid #000;
    [etc,etc]
}

它在Bootstrap 3.0中表现很好,因为所有col-md-X类都定义为较少的变量。但是在Bootstrap 3.1中,这似乎是用一个叫做make-grid-columns()的mixin函数来代替。

有人知道如何使用这个混合,以及如何将上面的构建移植到Bootstrap 3.1? : – /

解决方法

根据 the documentation,你可以使用.make-md-column(3); mixin,例如:
.myClass{
    .make-md-column(3); /* Replaces .col-md-3; */
    border: 1px solid #000;
    [etc,etc]
}

Bootstrap&LESS:仅作为参考导入mixins

Bootstrap&LESS:仅作为参考导入mixins

我正在使用Bootstrap 3.0&少1.5.我将为许多站点使用相同的bootstrap.css(或使用他们的CDN).所以我正在使用

@import (reference) "bootstrap-3.0.0/less/bootstrap.less";
@import (reference) "bootstrap-3.0.0/less/mixins.less";

仅作为参考导入.

我的app.less(其中包括)

.herocontainer{
    .make-row();
    .iphoneblock{
        .make-sm-column-offset(1);
        .make-sm-column(4);
        text-align: center;
    }
    .copyblock{
        .make-sm-column(5);
        text-align: center;
        .copytext{
            @media(min-width: @screen-sm) {
              padding-top: 100px;
              }
        }
        .buybutton{
            .btn-lg;
            .btn-primary;
            background-color: #d6822f;
            }
    }
}

生成的站点只是单列输出.但是,如果我从mixins中删除(引用),例如:

@import (reference) "bootstrap-3.0.0/less/mixins.less";

然后我得到一个两列响应输出,但生成的CSS也有我不需要的类.

所以,
a)我如何才能在css中获取我在app.less中编写的类,而不是使用bootstrap类来膨胀
b)我如何调试这样的CSS问题? (我确实使用Google Chrome工具,但这个问题比我能理解/调试的要多)

谢谢,
约瑟夫

解决方法

另见: https://stackoverflow.com/a/14463540/1596547.其中说:

No actual code will output from that file as CSS,but all becomes available to use as mixins.

在你的情况下,它们将与例如make-sm-column()有所区别,这个mixin包含一个媒体查询定义.如果您在导入mixins时使用(引用).此媒体查询部分不包含在您的CSS中.

// Generate the small columns
.make-sm-column(@columns; @gutter: @grid-gutter-width) {
  position: relative;
  // Prevent columns from collapsing when empty
  min-height: 1px;
  // Inner gutter via padding
  padding-left:  (@gutter / 2);
  padding-right: (@gutter / 2);

  // Calculate width based on number of columns available
  @media (min-width: @screen-sm-min) {
    float: left;
    width: percentage((@columns / @grid-columns));
  }
}

会给:

.herocontainer {
  position: relative;
  min-height: 1px;
  padding-left: 15px;
  padding-right: 15px;
}
@media (min-width: 768px) {
  .herocontainer {
    float: left;
    width: 33.33333333333333%;
  }
}

使用(参考)你只会得到:

.herocontainer {
  position: relative;
  min-height: 1px;
  padding-left: 15px;
  padding-right: 15px;
}

注意你也使用来自buttons.less的btn-lg.对我而言,它似乎是引用button.less但不是mixins.less的最佳解决方案(理论mixins只应包含mixins,因此引用应该有所不同).否则只需要你需要的mixins来创建一个mixins.less.

UPDATE

>有一个错误Reference import not importing media queries>当引用导入中的类从未引用的导入调用mixin时,此mixin的输出将在(css)中显示(意外).所以在上面的答案中没有使用mixins.less的参考确实会给很多不需要的类

bootstrap-4 – Bootstrap 4:如何在没有jQuery / minimal bootstrap.js的情况下使用NavBars?

bootstrap-4 – Bootstrap 4:如何在没有jQuery / minimal bootstrap.js的情况下使用NavBars?

我们网站上绝大多数页面只使用GRID和NAVBAR.我们在每个页面上加载所有jQuery和bootstrap.min.js是没有意义的.

实际上,唯一需要的JS是用于处理移动请求中NAVBAR的打开/关闭的js.

有没有人创建了一个最小的,小的.js来处理这个?

我找到了一堆Bootstrap 3,但我没有看到Bootstrap 4.

谢谢

解决方法

是!你可以用这个:

https://thednp.github.io/bootstrap.native/v4.html

随着cdn

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap.native@2.0.15/dist/bootstrap-native-v4.min.js"></script>

随着npm

运行命令:

npm install https://github.com/thednp/bootstrap.native

并导入:

var bsn = require(''bootstrap.native/dist/bootstrap-native-v4'');

关于Bootstrap源码之旅-mixins解读(1)bootstrap源码下载的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于bootstrap + bootstrap-table + jquery + bootstrap-paginator、Bootstrap 3.1如何使用mixin make-grid-columns()?、Bootstrap&LESS:仅作为参考导入mixins、bootstrap-4 – Bootstrap 4:如何在没有jQuery / minimal bootstrap.js的情况下使用NavBars?等相关内容,可以在本站寻找。

本文标签: