v3结合ts积累

1、
const keywordValue = ref({});

2、
const templateOptions = ref<{ label: string; value: string }[]>([]);
等同于
interface TemplateOption {
  label: string;
  value: string;
}
const templateOptions = ref([]);


      templateOptions: [
        { lable: "", value: "" },
        { lable: "", value: "" },
        { lable: "", value: "" },
        { lable: "", value: "" },
      ],


3、
const formState = ref<{ [key: string]: any }>({
  template: null, // 订阅模板
  keywordValue: [], // 存放订阅的模板对应的表单项
});

等同于
interface FormState {
  [key: string]: any;
}
const formState = ref({});

你可能感兴趣的:(#,ts,java,前端,javascript)