PHP头条
热点:

表单控件中怎样加ltphp,ElementUI自定义表单组件怎么加入验证功能


自定义了一个表单组件,但是想用上验证功能不知道如何下手了,求大佬帮忙看看。

这是我定义的控件file-choose,然后用rules不生效

rules: {

filePath: [

{required: true, message: '不能为空'}

]

},

这是控件的效果图,现在就是想实现对输入框的内容进行校验

bV100r?w=717&h=79

控件的代码

选择

:props="props"

:load="loadChild"

:highlight-current="true"

node-key="path"

lazy

ref="tree"

class="file-choose-tree">

取 消

@click="visible = false;$emit('input',$refs.tree.getCurrentNode().path)">确 定

import Vue from 'vue'

export default {

data() {

return {

visible: false,

files: [],

props: {

isLeaf: 'last'

}

}

},

props: ['value', 'model'],

methods: {

loadChild(node, resolve) {

this.$http.post('api/getChildDirList',

{

path: node.data.path || '',

model: this.model || 'dir',

})

.then((response) => {

let result = response.data;

if (result.status == 200) {

if (result.data) {

resolve(result.data);

}

} else {

this.$message(result.msg);

}

});

}

}

}

要怎么加上验证的功能呢?



www.phpzy.comtrue/phpzx/52530.htmlTechArticle表单控件中怎样加ltphp,ElementUI自定义表单组件怎么加入验证功能 自定义了一个表单组件但是想用上验证功能不知道如何下手了求大佬帮忙看看。 这是我定义的控件file-choose然后用rules不...

相关文章

PHP之友评论

今天推荐