Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Post from './components/Post.vue';
- new Vue ({
- el: 'body',
- components: { Post },
- data: {
- limitByNumber: 4
- }
- });
- <template>
- <div class="Post" v-for="post in list | limitBy limitByNumber">
- <!-- Blog Post -->
- ....
- </div>
- </template>
- <!-- script -->
- <script>
- export default {
- props: ['list', 'limitByNumber'],
- created() {
- this.list = JSON.parse(this.list);
- }
- }
- </script>
- <template>
- <div class="Post" v-for="post in list | limitBy this.$parent.limitByNumber">
- </div>
- </template>
- <template>
- <post :limit="limitByNumber"></post>
- </template>
- <script>
- export default {
- data () {
- return {
- limitByNumber: 4
- }
- }
- }
- </script>
- <template>
- <div class="Post" v-for="post in list | limitBy limit">
- <!-- Blog Post -->
- ....
- </div>
- </template>
- <!-- script -->
- <script>
- export default {
- props: ['list', 'limit'],
- created() {
- this.list = JSON.parse(this.list);
- }
- }
- </script>
- export default {
- name: 'LayoutDefault'
- getParent(name){
- let p = this.$parent;
- while(typeof p !== 'undefined'){
- if(p.$options.name == name) {
- return p;
- }else {
- p = p.$parent;
- }
- }
- return false;
- }
- this.getParent('LayoutDefault').myVariableOrMethod
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement