---
title: "mixin"
author: "千絮泠泉"
date: "2019-01-29T11:13:40Z"
tags: ["mixin"]
categories: ["编程语言"]
slug: "mixin"
draft: false
lastmod: "2019-01-29T11:14:12Z"
id: 2437207
url: "https://1971161579.iteye.com/blog/2437207"
---

```stylus

// base function
fn-width-center(w)
  position absolute
  width w
  margin-left 50% - w * 0.5

// caller
invoke(arg, fn)
  fn(arg)

// component
c-div-full(imgUrl)
  background url(imgUrl) no-repeat center
  background-attachment fixed
  background-size 100% 100%
  width 100%
  min-height 100%
  position: fixed

c-btn-center(imgUrl, btn-width)
  background url(imgUrl) no-repeat center
  invoke(btn-width, fn-width-center)
  background-size contain!important
  line-height 3
  top 88%
  border none
  cursor pointer


```