美文网首页
lodash 按键赋值

lodash 按键赋值

作者: charmingcheng | 来源:发表于2021-03-09 08:01 被阅读0次
    const defaultForm = {
      title: "",
      cid: "0",
      slug: '',
      media: [],
      additional: [],
      summary: "",
      content: "",
      orders: 0,
      flag: "1",
      seo_title: "",
      seo_description: ""
    };
    
    export default {
      data() {
        return {
          formData: {}
        }
      }
    }
    async fetchData() {
      const response = await this.$request.get(`/product/${id}`);
      this.formData = this.$_.pick(response.data, Object.keys(defaultForm))
    }
    
    
    

    相关文章

      网友评论

          本文标题:lodash 按键赋值

          本文链接:https://www.haomeiwen.com/subject/oglyfltx.html