第二十章第一节:属性分组页面获取tree数据结构
1、创建属性分组页面
src\views\modules\product\attrgroup.vue
2、页面内容
父组件调用子组件步骤:
1:导入 import Category from "../common/category";
2:注册 components: { Category},
3:调用 <category @children-onde-click="treenodeclick"></category>
4:获取数据
treenodeclick(data, node) {
console.log("tree子组件传递的数据是:",data,node);
},
<template>
<el-row :gutter="20">
<el-col :span="6">
<category @children-onde-click="treenodeclick"></category>
</el-col>
<el-col :span="18"></el-col>
</el-row>
</template>
<script>
//导入tree公共组件
import Category from "../common/category";
export default {
//import引入的组件需要注入到对象中才能使用
components: { Category},
data() {
return {};
},
methods: {
//tree公共组件点击时传递数据
treenodeclick(data, node) {
console.log("tree子组件传递的数据是:",data,node);
},
}
};
</script>
<style scoped>
</style>

浙公网安备 33010602011771号