demo.html 2.11 KB
<div id="fcheck_page" class="page out" data-title="check框">
	<div class="page-content" id="fcheck_content">
		<div id="fcheck-header"></div>
		<div id="fcheck-form"></div>
		<div id="fcheck1"></div>
		<div id="fcheck2"></div>
		<div id="fcheck-fbutton"></div>
	</div>
</div>
<script>
require(["NavHeader", "Form", "FCheck", "FButton", "mUtil"], function(NavHeader, Form, FCheck, FButton, mUtil) {
	var _u = require("mUtil");
	var hasClsPicker = typeof clsPicker !== "undefined";

	if(!hasClsPicker) {
		new NavHeader({
			el: "fcheck-header",
			option: {
				title: "表单-Check框",
				smallTitle: "fcheck"
			}
		}).render();
	}
	
	new Form({
		el: "fcheck-form",
		option: {
			submit : {
				action : "/mobilemode/mobile/demo/plugin/Form/formAction.jsp",//提交地址
				validate : function(){
					//表单提交前验证脚本
				}
			}
		}
	}).render();
	
	new FCheck({
		el: "fcheck1",
		option: {
			form : "fcheck-form",//所属表单id
			field : {
				label : "可编辑",
				name : "check1"
			}
		}
	}).render().then(function () {
		if (!hasClsPicker) return;

		_u.vetically("#fcheck1");

		clsPicker.golalSetting({
			container: ".wev-comp-FCheck",
			type: "FCheck"
		});

		new clsPicker({
			selector: ".wev-toggle",
			text: ".wev-toggle",
			lineYSkew: 20
		});
		new clsPicker({
			selector: ".wev-toggle-handle",
			text: ".wev-toggle-handle",
			lineYSkew: 20,
			position: "top right"
		});
	});
	
	if(!hasClsPicker) {
		new FCheck({
			el: "fcheck2",
			option: {
				form : "fcheck-form",//所属表单id
				field : {
					label : "只读", //必填
					name : "check2",//必填  字段NAME
					value : 1
				},
				readonly:true
			}
		}).render();
		
		
		new FButton({
			el: "fcheck-fbutton",
			container: "#fcheck_page",
			option: {
				form : "fcheck-form",
				btns : [
					{
						text : "重置",
						action : "reset"
					},
					{
						text : "提交",
						action : "submit",
						callback : function(billid) {
							console.log(billid);
						},
						remindMsg : "操作成功"
					}
				],
				fixed : true
			}
		}).render();
	}

	mUtil.trigger('load');//页面渲染完成回调
});
</script>