js開發技巧總結

<q-dialog v-model="edithandovermodal">
      <q-card style="min-width: 500px;">
        <q-toolbar>
          <q-toolbar-title>重命名</q-toolbar-title>
          <q-btn icon="close" flat round dense v-close-popup/>
        </q-toolbar>
        <q-card-section>
          <q-input v-model="editItem.name" />
        </q-card-section>
        <q-card-actions align="right">
          <q-btn label="確定" @click.stop="update(editItem, 'edit')" color="primary" dense />
          <q-btn label="取消" v-close-popup color="negative" dense />
        </q-card-actions>
      </q-card>
    </q-dialog>

 

var a = "1,3,2"
先轉成數組:
let b = [...a]
console.log(b) //["1", ",", "3", ",", "2"]



list:['test','111']
let str3 = list.join(',')  // 逗號分隔
console.info('str3', str3)

 

 this.$refs.senddeptForm

<senddept ref="senddeptForm" :eventDeptList = "eventDeptList" :userSetting="userSetting"/>

 

 

 

 

 

給列表中的數據添加一個屬性

querySysDept(pid = '0') {
      this.loading = true;
      return this.$axios.post('sys/querySysDept', { pid })
        .then((r) => r.data.map((v) => ({
          lazy: true,
          ...v,
        }))).finally(() => {
          this.loading = false;
        });
    },

 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .b{
      position: relative;
      width: 400px;
      height: 400px;
      background: #f00;
      margin:200px
    }
    .c1{
      position: absolute;
      left: 0;
      top:-40px;
      height: 40px;
      width: 200px;
      background: #00f;
    }
    .c2{
      position: absolute;
      left: -40px;
      top:0px;
      height: 100%;
      width: 40px;
      background: #0f0;
    }
    .c3{
      position: absolute;
      left: auto;
      right:0;
      top:-40px;
      height: 40px;
      width: 200px;
      background: #0ff;
    }
  </style>
</head>
<body>
  <div class="b">
    <div class="c2"></div>
    <div class="c3"></div>
    <div class="c1"></div>
  </div>
</body>

</html>

 

 

<script>
  const l = [{
    c:false,
  }]
  const l2=[{
    s:[]
  }]
  showlist
  const t={
    get(){
      return l.filter(v=>!v.c).length===0
    },
    set(v){
      l.forEach(z=>z.c=v)
    }
  }


  {
    data(){
      return {
        cl:[{
          cs:[]
        }],
        showlist:[]
      }
    },
    methods:{
      input(v){
        this.showlist = v.cs;
      }
    }
  }
</script>
Object.keys(d).forEach((key) => {
        if (key.startsWith('AsText(')) {
          const realkey = key.slice(7, key.length - 1);
          d[realkey] = d[key].slice(6, d[key].length - 1).split(' ');
        }
      });
JSON.parse(dd.trim());

JSON.stringify(r.data);
this.$nextTick(() => {
        const result = this.reductionParams(JSON.parse(a.data.payload.formConfig));
        // console.log(result);
        this.formData = {
          ...result,
          list: result.list.filter((el) => !el.attr.notree),
        };
        this.filterItemByHeight(result.list);
        this.getAllKey(result.list);
        // console.log(this.formData);
      });
@tap="btnTap" 父組件給子組件一個函數
this.$emit('tap', type);  子組件調用父組件




query() {
      const { id } = this.$route.query;
      return this.$axios_r.get(`cstForm/getFormInfo/${id}`);
},


async request() {
      const a = await this.query();

}

<slot></slot>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章