账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    avue框架中,avue-crud组件新增中,怎么监听type为tree时变化的事件
    43
    0
    问题描述如题,我希望在选择企业名称的时候给企业ID赋值,但是avue死活监听不到选择时的事件,求解决。相关代码粘贴代码文本(请勿用截图) <avue-crud ref="crud" :option="option" v-model="form" :page="page" :table-loading="listLoading" :data="list" @search-change="searchChange" @refresh-change="refreshChange" @size-change="sizeChange" @current-change="currentChange" @row-update="handleUpdate" @row-save="create" @row-del="rowDel" > </avue-crud> { fixed: true, label: '企业名称', prop: 'name', search: true, labelWidth: 160, span: 20, type: "tree", dicData:[], addDisplay: true, editDisplay: true, hide: true, props: { label: "name", value: "id" }, rules: [ { required: true, message: "请选择企业名称", trigger: "click", } ] }
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 猫与蔷薇 普通会员 1楼

      在Avue框架中,你可以在<avue-crud>组件中监听type属性为tree时的事件。这可以通过使用@avue/api-crud包中的listen方法来实现。

      首先,你需要在你的组件中引入这个包:

      html <avue-crud @avue/api-crud="yourCRUDMethod"></avue-crud>

      然后,你可以使用listen方法来监听type属性的变化。在这个例子中,我们将监听当数据的类型为tree时的事件:

      javascript export default { data() { return { treeData: null }; }, methods: { yourCRUDMethod() { this.treeData = this.data; } }, mounted() { this.listen('type:tree', this.yourCRUDMethod); } };

      在这个例子中,当type属性变化为tree时,yourCRUDMethod方法将被调用。你可以在这个方法中进行任何你需要的数据操作。

      注意,listen方法的第一个参数是你想要监听的事件类型,第二个参数是你想要在事件发生时调用的方法。在本例子中,我们想要在type:tree事件发生时调用yourCRUDMethod方法。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部