-
Notifications
You must be signed in to change notification settings - Fork 899
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #946 from museui/feature-components
Feature components
- Loading branch information
Showing
66 changed files
with
2,412 additions
and
538 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
# 指令 | ||
|
||
Muse-UI 提供 `v-click-outside` 、 `v-resize` 和 `v-scroll` 三个指令。 | ||
|
||
|
||
## ClickOutside | ||
|
||
:::demo | ||
```html | ||
<div class="demo-content-block" @click="message='click here....'" v-click-outside="clickoutside">{{message}}</div> | ||
<script> | ||
export default { | ||
data () { | ||
return { | ||
message: 'click! click! click!' | ||
}; | ||
}, | ||
methods: { | ||
clickoutside () { | ||
this.message = 'click outside' | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
.demo-content-block { | ||
width: 100%; | ||
height: 200px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
</style> | ||
|
||
``` | ||
::: | ||
|
||
## Resize | ||
|
||
:::demo | ||
```html | ||
<div class="demo-content-block" v-resize="resize"> | ||
<p style="margin-right: 16px;">Window Size:</p> | ||
<p>width: {{width}}px height: {{height}}px</p> | ||
</div> | ||
<script> | ||
export default { | ||
data () { | ||
return { | ||
width: 0, | ||
height: 0 | ||
}; | ||
}, | ||
mounted () { | ||
this.width = window.innerWidth; | ||
this.height = window.innerHeight; | ||
}, | ||
methods: { | ||
resize () { | ||
this.width = window.innerWidth; | ||
this.height = window.innerHeight; | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
.demo-content-block { | ||
width: 100%; | ||
height: 200px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
</style> | ||
|
||
``` | ||
::: | ||
|
||
## Scroll | ||
|
||
:::demo | ||
```html | ||
<div class="demo-content-block" v-scroll="scroll"> | ||
<p style="margin-right: 16px;">ScrollTop:</p> | ||
<p>{{scrollTop}}</p> | ||
</div> | ||
<script> | ||
export default { | ||
data () { | ||
return { | ||
scrollTop: 0 | ||
} | ||
}, | ||
mounted () { | ||
this.scrollTop = window.scrollY; | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
.demo-content-block { | ||
width: 100%; | ||
height: 200px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
</style> | ||
|
||
``` | ||
::: | ||
|
||
|
||
## 按需引入 | ||
|
||
工具类的组件在 `lib/Helpers` 目录下 | ||
|
||
```javascript | ||
import Vue from 'vue'; | ||
import Helpers from 'muse-ui/lib/Helpers'; | ||
|
||
Vue.use(Helpers); | ||
``` | ||
|
||
<script> | ||
export default { | ||
data () { | ||
return { | ||
message: 'click! click! click!', | ||
width: 0, | ||
height: 0, | ||
scrollTop: 0 | ||
}; | ||
}, | ||
mounted () { | ||
this.width = window.innerWidth; | ||
this.height = window.innerHeight; | ||
this.scrollTop = window.scrollY; | ||
}, | ||
methods: { | ||
clickoutside () { | ||
this.message = 'click outside' | ||
}, | ||
resize () { | ||
this.width = window.innerWidth; | ||
this.height = window.innerHeight; | ||
}, | ||
scroll () { | ||
this.scrollTop = window.scrollY; | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
.demo-content-block { | ||
width: 100%; | ||
height: 200px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
</style> | ||
|
Oops, something went wrong.