vuejs 동적 으로 input 상자 의 실례 설명 추가
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="front" value="${frontPath}${pageContext.request.contextPath}/f"/>
<c:set var="ajaxUrl" value="${frontPath}${pageContext.request.contextPath}"/>
<c:set var="ctxStatic" value="${pageContext.request.contextPath}/static"/>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title> </title>
<link href="${ctxStatic}/plugins/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="external nofollow" rel="stylesheet">
<script src="${ctxStatic}/plugins/jquery-3.2.1.min.js"></script>
<script src="${ctxStatic}/plugins/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script src="${ctxStatic}/modules/front/selfHelpRegistration/common/js/common.js"></script>
<link href="${ctxStatic}/modules/front/selfHelpRegistration/common/css/common.css" rel="external nofollow" rel="stylesheet">
<link href="${ctxStatic}/plugins/jquery-confirm-3.3.0-dist/jquery-confirm.min.css" rel="external nofollow" rel="stylesheet">
<script src="${ctxStatic}/plugins/jquery-confirm-3.3.0-dist/jquery-confirm.min.js"></script>
<script src="${ctxStatic}/modules/front/selfHelpRegistration/js/local_expire.js"></script>
<script src="${ctxStatic}/plugins/wangEditor-3.1.1/wangEditor.js"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import stylesheet -->
<link rel="stylesheet" href="//unpkg.com/iview/dist/styles/iview.css" rel="external nofollow" >
<!-- import iView -->
<script src="//unpkg.com/iview/dist/iview.min.js"></script>
<link href="${ctxStatic}/modules/front/selfHelpRegistration/css/base.css" rel="external nofollow" rel="stylesheet">
<style type="text/css">
.ivu-form .ivu-form-item-label,
.ivu-input{ font-size: 14px; }
.full-writer-left{ width: 680px; }
.full-writer-right{ display: flex; flex: 1;}
.full-writer-left,
.full-writer-right{
padding: 0;
}
.full-writer-left h1,
.full-writer-right h1{
margin: 0;
font-size: 16px;
}
.full-writer-left .template,
.full-writer-right .template{
padding: 15px;
}
.full-writer-right .template{
display: flex;
padding: 0;
border-top: 1px solid #e7e7e7;
}
.fillHtml{
flex: 1;
padding: 15px;
}
.full-writer-head {
display: flex;
align-items: center;
height: 50px;
padding: 0 15px;
justify-content: space-between;
}
.template-bg{ padding: 15px; background: #e7e7e7;}
.template-wrap{ height: 100%; padding: 15px 50px; background: #fff; overflow: auto;}
.templateHtml{ font-size: 18px; line-height: 30px; color: #000; overflow: auto;}
.templateHtml p{ margin: 15px 0px;}
.full-writer-left .templateHtml h1,.template-h1{
text-align: center;
font-size: 26px;
font-weight: bold;
margin: 15px;
color: #000;
}
.template-text{ text-indent: 1cm; }
.fill-item{
border: 1px solid #ddd;
margin-bottom: 15px;
}
.fill-tit{
position: relative;
display: flex;
align-items: center;
padding: 0 15px;
line-height: 45px;
background: #e7e7e7;
}
.fill-tit>span{ margin-right: 20px; }
.fill-tit .button{ margin-right: 15px; }
.fill-tit .close{
position: absolute;
right: 10px;
width: 30px;
line-height: 30px;
border-radius: 50%;
text-align: center;
background: #d9534f;
font-size: 16px;
color: #fff;
opacity: 1;
}
.fill-center{
padding: 15px;
}
.fill-center .fill-item{
margin-bottom: 15px;
}
.form-list{
margin-bottom: 15px;
}
.fill-center .fill-item:last-child{
margin-bottom: 0;
}
.steps-wrap{
width: 169px;
padding: 15px;
background: #fff;
box-shadow: -2px 1px 10px #b3b3b3;
}
.slider-nav li {
position: relative;
list-style: none;
padding: 15px 15px 15px 18px;
float: none;
text-align: left;
font-size: 14px;
}
</style>
</head>
<body>
<div class="page-wrap" id="app">
<header>
<div class="head-left">
<h1>
<span>XinYi People's Court Intelligent complaint generation system</span>
</h1>
<p id="todayDate"></p>
</div>
<div class="btn-box" id="top-nav-btn">
</div>
</header>
<div class="page-content no-pad">
<div class="full-box write">
<div class="full-writer">
<div class="full-writer-left">
<div class="full-writer-head">
<div class="full-writer-head-l">
<h1> </h1>
</div>
<div class="full-writer-head-r">
<a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="m-btn button b-info" id="preview-btn"><i class="icon-printer"></i><span> </span></a>
<a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="m-btn button b-info" id="preview-btn"><i class="icon-printer"></i><span> </span></a>
</div>
</div>
<div class="template template-bg">
<div class="template-wrap">
<div id="templateHtml" class="templateHtml">
<h1 class="template-h1"> </h1>
<div class="model-list" v-for="(list,index) in lists">
<label> :</label>{{ list.plaintiffName }},{{list.plaintiffSex}}, {{list.plaintiffAge}} , {{list.plaintiffNation}},{{list.plaintiffAddress}}, :{{list.plaintiffUserId}}, :{{list.plaintiffTel}}<br/>
</div>
<div class="model-list" v-for="(list,index) in gList">
<label> :</label>{{ list.tissueName }}, :{{ list.tissueUserName}}<br/>
</div>
<div class="model-list" v-for="(list,index) in bgzList">
<label> :</label>{{ list.defendantName }},{{list.defendantSex}}, {{list.defendantAge}} , {{list.defendantNation}},{{list.defendantAddress}}, :{{list.defendantUserId}}, :{{list.defendantTel}}<br/>
</div>
<div class="model-list" v-for="(list,index) in gList">
<label> :</label>{{ list.tissueName }}, :{{ list.tissueUserName}}<br/>
</div>
<label> :</label>
<p class="template-text" v-html="formItem.textarea"></p>
<label> :</label>
<p class="template-text" v-html="formItem.textarea2"></p>
<p style="text-indent: 1cm;"> </p>
<p> </p>
<p style="text-align: right; padding-right: 3cm;"> ( ):</p>
<p style="text-align: right;"> </p>
</div>
</div>
</div>
</div>
<div class="full-writer-right">
<div class="full-writer-head">
<div class="full-writer-head-l">
<h1 id="html-title"> </h1>
</div>
<div class="full-writer-head-r">
<a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="m-btn button b-primary" id="save-btn"><i class="icon-drawer"></i><span> </span></a>
<a href="javascript:history.go(-1);" rel="external nofollow" class="m-btn button b-danger"><i class="icon-arrow-left2"></i><span> </span></a>
</div>
</div>
<div class="template">
<div id="selfHtml" class="templateHtml fillHtml">
<i-form :label-width="100">
<div class="fill-item">
<div class="fill-tit">
<span> </span>
<a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" v-on:click="add" class="s-btn button b-primary"><span> </span></a>
<!-- <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="s-btn button b-primary"><span> </span></a> -->
<a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" v-on:click="addZZ" class="s-btn button b-primary"><span> </span></a>
</div>
<div class="fill-center" id="plaintiff-list">
<!-- -->
<div class="form-list" v-for="(list,index) in lists">
<div class="fill-item">
<div class="fill-tit">
<span> ( )</span>
<div class="close" v-on:click="del(index)"><i class="icon-close"></i></div>
</div>
<div class="fill-center" class="plaintiff-form">
<row>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.plaintiffName" placeholder=" " name="name"></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item label=" :">
<radio-group v-model="list.plaintiffSex" name="sex">
<radio label=" "> </radio>
<radio label=" "> </radio>
</radio-group>
</form-item>
</i-col>
</row>
<row>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.plaintiffAge" placeholder=" " name="age"></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.plaintiffNation" placeholder=" " name="nation"></i-input>
</form-item>
</i-col>
</row>
<row>
<i-col span="24">
<form-item label=" :">
<i-input v-model="list.plaintiffAddress" placeholder=" " name="address"></i-input>
</form-item>
</i-col>
</row>
<row>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.plaintiffUserId" placeholder=" " name="identityCardNumber"></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.plaintiffTel" placeholder=" " name="mobileNumber"></i-input>
</form-item>
</i-col>
</row>
</div>
</div>
</div>
<!-- end -->
<!-- -->
<div class="form-list" v-for="(list,index) in gList">
<div class="fill-item">
<div class="fill-tit">
<span> ( )</span>
<div class="close" v-on:click="delZZ(index)"><i class="icon-close"></i></div>
</div>
<div class="fill-center">
<row>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.tissueName" placeholder=" "></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.tissueUserName" placeholder=" "></i-input>
</form-item>
</i-col>
</row>
</div>
</div>
</div>
<!-- end -->
</div>
</div>
<div class="fill-item">
<div class="fill-tit">
<span> </span>
<a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" v-on:click="addBGZ" class="s-btn button b-primary"><span> </span></a>
<!-- <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="s-btn button b-primary"><span> </span></a> -->
<a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" v-on:click="addBGG" class="s-btn button b-primary"><span> </span></a>
</div>
<div class="fill-center">
<!-- -->
<div class="form-list" v-for="(list,index) in bgzList">
<div class="fill-item">
<div class="fill-tit">
<span> ( )</span>
<div class="close" v-on:click="delBGZ(index)"><i class="icon-close"></i></div>
</div>
<div class="fill-center">
<row>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.defendantName" placeholder=" "></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item label=" :">
<radio-group v-model="list.defendantSex">
<radio label=" "> </radio>
<radio label=" "> </radio>
</radio-group>
</form-item>
</i-col>
</row>
<row>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.defendantAge" placeholder=" "></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.defendantNation" placeholder=" "></i-input>
</form-item>
</i-col>
</row>
<row>
<i-col span="24">
<form-item label=" :">
<i-input v-model="list.defendantAddress" placeholder=" "></i-input>
</form-item>
</i-col>
</row>
<row>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.defendantUserId" placeholder=" "></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.defendantTel" placeholder=" "></i-input>
</form-item>
</i-col>
</row>
</div>
</div>
</div>
<!-- -->
<!-- -->
<div class="form-list" v-for="(list,index) in bggList">
<div class="fill-item">
<div class="fill-tit">
<span> ( )</span>
<div class="close" v-on:click="delBGG(index)"><i class="icon-close"></i></div>
</div>
<div class="fill-center">
<row>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.tissueName" placeholder=" "></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item label=" :">
<i-input v-model="list.tissueUserName" placeholder=" "></i-input>
</form-item>
</i-col>
</row>
</div>
</div>
</div>
<!-- end -->
</div>
</div>
<div class="fill-item">
<div class="fill-tit">
<span> </span>
</div>
<div class="fill-center">
<div id="div1"></div>
<!-- <i-input v-model="formItem.textarea" type="textarea" :autosize="{minRows: 8,maxRows: 15}" placeholder=" ..."></i-input> -->
</div>
</div>
<div class="fill-item">
<div class="fill-tit">
<span> </span>
</div>
<div class="fill-center">
<div id="div2"></div>
<!-- <i-input v-model="formItem.textarea2" type="textarea" :autosize="{minRows: 8,maxRows: 15}" placeholder=" ..."></i-input> -->
</div>
</div>
</i-form>
</div>
<!-- -->
<div class="steps-wrap">
<ul class="slider-nav">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ul>
</div>
</div>
</div>
</div>
<!-- <div class="head">
<div class="head-r">
</div>
</div> -->
</div>
</div>
</div>
<!-- -->
<div id="createDialog" class="crudDialog" hidden>
<div class="form-group">
<div class="read-icon">
<img class="img-responsive center-block" src="${ctxStatic}/modules/front/selfHelpRegistration/image/sfz.jpg">
</div>
<div class="read-txt">
<p> </p>
</div>
</div>
</div>
<script type="text/javascript">
var hour = 1000*60*60 ;
var frontPath = "${front}";
var info = getLocalValue("cardInfo",hour);
if(info){
$("#top-nav-btn").html("");
var htmlTxt = "<a href='javascript:;' class='s-btn m-btn'><i class='icon-user2'>" +
"</i><span>"+info.name+"</span></a>" +
"<a href='javascript:;' onclick=location.href='${front}/selfHelpRegistration/index' class='s-btn m-btn button b-info'>" +
"<i class='icon-homepage_fill'></i>" +
"<span> </span></a>" +
"<a href='javascript:;' onclick=location.href='${front}/selfHelpRegistration/myList' class='s-btn m-btn button b-info'>" +
"<i class='icon-file-text2'></i>" +
"<span> </span></a>" +
"<a href='javascript:;' onclick='logout();' class='s-btn m-btn button b-danger'>" +
"<i class='icon-out'></i><span> </span>" +
"</a>";
$("#top-nav-btn").html(htmlTxt);
}else{
$("#top-nav-btn").html("");
var htmlTxt = "<a href='javascript:;' class='s-btn m-btn' onclick='login();'>" +
"<i class='icon-user2'></i>" +
"<span id='username'> </span>" +
"</a>";
$("#top-nav-btn").html(htmlTxt);
}
function getQueryString(name) {
var result = window.location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
if (result == null || result.length < 1) {
return "";
}
return result[1];
}
function mockLogin(){
localStorage.setItem("userICN","12300");
var info = new Object();
info.userIdentific = 12300;
setLocalValue('cardInfo', info);
}
$(document).ready(function(){
});
</script>
<!-- v2 -->
<script>
var vm = new Vue({
el : "#app",
data:{
tables : [],
lists:[{
plaintiffName: '',
plaintiffSex: ' ',
plaintiffAge: '',
plaintiffNation: '',
plaintiffAddress: '',
plaintiffUserId: '',
plaintiffTel: ''
}],
gList:[{
tissueName: '',
tissueUserName: ''
}],
bgzList:[{
defendantName: '',
defendantSex: ' ',
defendantAge: '',
defendantNation: '',
defendantAddress: '',
defendantUserId: '',
defendantTel: ''
}],
bggList:[{
tissueName: '',
tissueUserName: ''
}],
formItem:{
textarea: '',
textarea2: ''
}
},
methods:{
add:function(){
let cope = {
plaintiffName: '',
plaintiffSex: ' ',
plaintiffAge: '',
plaintiffNation: '',
plaintiffAddress: '',
plaintiffUserId: '',
plaintiffTel: ''
}
this.lists.push(cope);
console.log(this.lists)
},
del:function(index){
this.lists.splice(index,1);
console.log(this.lists)
},
addZZ:function(){
let cope = {
tissueName: '',
tissueUserName: ''
}
this.gList.push(cope);
},
delZZ:function(index){
this.gList.splice(index,1);
},
addBGZ:function(){
let cope = {
defendantName: '',
defendantSex: ' ',
defendantAge: '',
defendantNation: '',
defendantAddress: '',
defendantUserId: '',
defendantTel: ''
}
this.bgzList.push(cope);
},
delBGZ:function(index){
this.bgzList.splice(index,1);
},
addBGG:function(){
let cope = {
defendantName: '',
defendantSex: ' ',
defendantAge: '',
defendantNation: '',
defendantAddress: '',
defendantUserId: '',
defendantTel: ''
}
this.bggList.push(cope);
},
delBGG:function(index){
this.bggList.splice(index,1);
}
}
});
//
var E = window.wangEditor
var editor = new E('#div1')
//
editor.customConfig.menus = [
'bold',
'italic',
'justify', //
'underline'
]
editor.customConfig.onchange = function (html) {
// ,
vm.formItem.textarea = html;
}
editor.create()
vm.formItem.textarea = editor.txt.html();
$("#div1 .w-e-text-container").css("height","120px");
var editor = new E('#div2')
//
editor.customConfig.menus = [
'bold',
'italic',
'justify', //
'underline'
]
editor.customConfig.onchange = function (html) {
// ,
vm.formItem.textarea2 = html;
}
editor.create()
vm.formItem.textarea2 = editor.txt.html();
$("#div2 .w-e-text-container").css("height","120px");
</script>
</body>
</html>
효과 그림:확장 지식:vue 에서 단 추 를 누 르 고 입력 상 자 를 추가 하 는 방법
<div>
<el-button type="primary" style="margin-top: 10px;" @click="addProducts"> </el-button>
<el-form >
<el-form-item>
<el-table :data="productNews" border>
<el-table-column prop="name" label=" ">
<template slot-scope="scope">
<el-input
v-model="productNews[scope.$index].name
@focus="getAlert()"></el-input> </template> </el-table-column> <el-table-column prop="manufacturer" label=" " width="100"> <template slot-scope="scope"> <el-input v-model="productNews[scope.$index].manufacturer" ></el-input> </template> </el-table-column> <el-table-column label=" " width="70"> <template slot-scope="scope"> <el-button type="text" size="small" @click="removeProduct(scope.$index)"> </el-button> </template> </el-table-column> </el-table> </el-form-item> </el-form> </div></template><script>
js 방법:
export default {
data(){ return{ productNews:[] } },
methods:{
addProducts(){ this.productNews.push({car:''}) },
getAlert(){ },
removeProduct(index){ this.productNews.splice(index,1); } } }</script>
입력 상자 에 v-model 이 하나의 배열 produtNews[scope.$index].manufacturer 를 사용 하여 추가 할 때 배열 아래 에 하 나 를 추가 하고 삭제 할 때 배열 아래 에 하 나 를 줄 이 는 것 입 니 다.이상 vuejs 동적 으로 input 상 자 를 추가 한 실례 설명 은 바로 소 편 이 여러분 에 게 공유 한 모든 내용 입 니 다.여러분 에 게 참고 가 되 고 저희 도 많이 응원 해 주시 기 바 랍 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Vue.js + Google Places: 여러 입력 필드 자동 완성경우에 따라 두 개 이상의 입력 필드에 장소 자동 완성 기능을 추가할 수 있습니다. 일반적인 예는 두 위치 사이의 이동 거리를 찾는 것입니다. 이 경우 사용자는 자동 완성 기능이 활성화된 두 개의 입력 필드를 갖게 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.