1.ts参数类型
export default class TabPane extends Vue { @Prop({ default: 'CN' }) private type!: string
type!: string和 type?: string是相对的,!表示必填?表示可填可不填
2.表单提交
eg1:import { Form as ElForm, Input } from 'element-ui'
(this.$refs.loginForm as ElForm).validate((valid: boolean) => {
eg2:定义变量
let el:any = this.$refs.loginFormel.validate((valid: boolean) => {
3.索引
statusFilter(status: string) { const statusMap: { [ids: string]: string } =
{ published: 'success', draft: 'info', deleted: 'danger' }
ids为索引,用[]包括;