Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate from v-repeat to v-for while using partial inside the loop #1363

Closed
vprimachenko opened this issue Sep 27, 2015 · 4 comments
Closed
Labels

Comments

@vprimachenko
Copy link

I have trouble migrating following code to Vue 1.0. I use 1.0.0-alpha.6 as a migration path.

<label v-repeat="param in params">
    {{$key}} : <partial :name="'editor-'+param.type"></partial>
</label>

Vue setup

new Vue({
    el: 'body',
    data: {
        params: {
            paramA : {
                type: 'number',
                value: 42
            }
        },
    },
    partials: {
        'editor-number': '<input v-model="param.value" type="number">'
    }
})

as the v-for version throws warnings and an error i believe this to be a bug

@vprimachenko
Copy link
Author

sorry to necro, but it seems the issue is deeper. c.f.:

<div v-repeat="collection in document">editor for {{$key}}<br>
    <template v-for="input_type in schema[collection.type]">
        <partial :name="'editor-'+input_type"></partial>
    </template>
</div>
<div v-for="collection in document">editor for {{$key}}<br>
    <template v-for="input_type in schema[collection.type]">
        <partial :name="'editor-'+input_type"></partial>
    </template>
</div>
window.demo = new Vue({
    el: 'body',
    data: {
        document: {
            'collection#1': {
                "type": 'test_collection',
            }
        },
        schema : {
            test_collection: {
                "foo":"number",
            }
        }
    },
    partials: {
        'editor-number': '<input v-model="collection[$key].value" type="number"> {{collection | json}}'
    }
})

when outer loop is changed to v-for the input lose its value on blur

@yyx990803
Copy link
Member

That's actually a separate issue, opening a new one in #1370.

@chenjie-cnooc
Copy link

can i use ionic components in vuejs? such as collection-repeat and mobile ui

@simplesmiler
Copy link
Member

@chenjie-cnooc I don't see how this is related to the topic, but no. Ionic depends on angular, and angular component directives are not compatible with vue and will require almost complete rewrite. The only thing you can reuse from ionic is CSS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants