一些我常用的css 或者 js

  三角形
width: 0; height: 0; border-width: 10px; border-color: transparent transparent red transparent; border-style: dashed dashed solid dashed

 

图片自适应   
.img-box { width: 18%; margin: 0 2% 0 0; background-size: cover; background-position: 50% 50%; &::before { content: ""; display: block; width: 100%; padding-top: 100%; } }

  

对象变数组(用的vue 里的lodash)
[].concat(this.CategoryId)

  

数组转字符串  用 arry.json()

  

        for (let catItem of catItems) {
          Vue.set(this.categories, `${catItem.Id}`, {})
          Http.$http.get(`v1.1/CompanyCategories/${catItem.Id}?fields=SubCategories`).then((response) => {
            this.categories[`${catItem.Id}`] = response.data
          })
        }

  

vue 用数据加载背景
<div :style="{ backgroundImage: 'url('+imgSrc+')' }">   js.data  imgSrc:'bt_help_album-

  

添加组件

父组件
import companyList from './list/index.vue'
components: {
    companyList
},

父组件给子组件传参

子组件
props: {
    item: {
      type: Object
    }
},
父组件
<company-list :item="item"></company-list>

子组件给父组件传参

子组件 closeSearch() { this.show = false this.$emit('handleShow', this.show); //第一个参数是父组件中v-on绑定的自定义回调方法,第二个参数为传递的参数 }, 父组件 <search @handleShow="changeShow()" :currType="currType" :ActionArgsJson="ActionArgsJson"></search> changeShow(show) { this.show = show; },

  

猜你喜欢

转载自www.cnblogs.com/beiqi/p/9473241.html
今日推荐