两个问题:
element-ui Transfer 穿梭框无法移动到左边
2.post提交时host是连续性的后台无法处理,每个IP之间如何以逗号分隔在传递到后台
代码如下:
<el-row type="flex" justify="start">
<el-col xs:="2" :sm="22">
<el-form-item label="认证主机" prop="host">
<el-transfer filterable filter-placeholder="请选择需要认证的主机" :titles="['未认证主机', '将认证主机']" :left-default-checked="[]" :footer-format="{noChecked: '${total}', hasChecked: '${checked}/${total}'}" v-model="form.host" :data="data" :props="{key:'authip', label:'authip'}">
<el-button class="transfer-footer" slot="left-footer" size="small">操作</el-button>
<el-button class="transfer-footer" slot="right-footer" size="small">操作</el-button>
</el-transfer>
</el-form-item>
</el-col>
</el-row>
<script>
import axios from 'axios'
export default {
name: 'hostauth',
data () {
return {
data: []
}
},
methods: {
submitForm(formname) {
this.$refs[formname].validate((valid) => {
if (valid) {
axios.post('/api/host', {
name: this.form.user,
host: this.form.host,
port: this.form.port,
passwd: this.form.passwd,
action: 'auth'
})
.then(function(res){
})
.catch(function(err){
console.log(err);
});
}else {
console.log('error submit!!');
return false;
}
});
}
}, /*methods end*/
mounted() {
var _this = this;
this.$nextTick(function(){
axios.get('/api/host', {
params: {
action: 'noauth'
}
})
.then(function(res){
_this.data = res['data'];
})
.catch(function(err){
console.log(err);
});
});
}
}
</script>
代码都不缩进的,不看 !!!