12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import pickerMixin from './picker-mixin'
- const pickerMixinInternal = {
- // 把内部picker暴露给外层组件
- inject: {
- RegisterPicker: { default: undefined },
- },
- created() {
- this.RegisterPicker?.(this)
- },
- mixins: [pickerMixin],
- props: {
- /**
- * 对话框的标题
- */
- title: {
- type: String,
- default: '请选择',
- },
- /**
- * 备选项label字段名
- */
- optionLabel: {
- type: String,
- default: 'name',
- },
- /**
- * 备选项value字段名
- */
- optionValue: {
- type: String,
- default: 'id',
- },
- /**
- * <p>备选项每行的渲染函数</p>
- * <pre>(item, direction) => vNode|string</pre>
- */
- render: {
- type: Function,
- default: function(item) {
- return item[this.optionLabel]
- },
- },
- /**
- * 设置对话框的props
- */
- modalProps: {
- type: Object,
- default: () => ({}),
- },
- },
- methods: {
- openPicker() {
- // tree-picker,通过this.$refs.picker获取
- // value-picker,通过this获取
- const picker = this.$refs.picker || this
- picker.inputClick()
- },
- },
- }
- export default pickerMixinInternal
|