UNPKG

cnetong-core-frontend

Version:

## 1. 开始使用 ```js // 在npm项目中的main.js文件中加入以下代码 import Base from "cnetong-core-frontend";

39 lines (36 loc) 811 B
let component = { props: { value: { type: String, default: null }, type: { type: String, default: null } }, data() { return { text: "" }; }, computed: {}, render(h) { // 不然可能无法正常更新. let value = this.value; this.$store.dispatch("base/loadSysCode", this.type).then(codes => { let c = codes.find(c => c.value === value); if (c) { this.text = c.label; } }); return <span class={{'font-red-error': !this.text}}>{this.text ? this.text : this.$t("ui.sysCode.noCode")}</span>; } }; let directive = { bind(el, binding, vnode, oldnode) { let codeType = binding.value; vnode.context.$store.dispatch("base/loadSysCode", codeType); } }; export default {directive, component};