question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can Component not have a template?

See original GitHub issue

In some scenes, maybe one model needs to have several children models in its scope because childs need to share data and methods of their parent midel, like below.

<div id="parent">
    <!-- model parent -->
    <div id="child1">
        <!-- model child1 -->
    </div>
    <div id="child2">
        <!-- model child2 -->
    </div>
        ...
</div>

I have tried the simplest way, but it didn’t work. There is one effective model, the parent.

var parent=new Vue({
    el:'#parent',
...
});
var child1=new Vue({
    el:'#child1',
...
});
..

Then I thought components should be used. But I didn’t want to make a component, but a thing like controller in angular. Can I just do this?

Vue.component('child1',{
    inherit:true,
    el:'#child',
    ...
});

or like below?

var child1=parent.$addChild({
    inherit:true,
    el:'#child1',
    ...
});

Vue is awesome, but components may be too heavy for such scenes I have mentioned. By the way, it seems that chrome app doesn’t support component system, it give an error like this:

Uncaught TypeError: Cannot read property '$before' of undefined  vue.min.js:7

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
yyx990803commented, Mar 25, 2015
1reaction
yyx990803commented, Feb 21, 2015

Just a random idea, maybe an attribute flag, e.g. <div v-component="x" inline-template>, which indicates that you don’t want content transclusion for what’s inside the component?

Read more comments on GitHub >

github_iconTop Results From Across the Web

In Angular2 I have a component that doesnt require a template ...
1 Answer 1 · 1. I've made that change, now I get this error: ReferenceError: Directive is not defined · 2. import {...
Read more >
Introduction to components and templates - Angular
A component controls a patch of screen called a view. It consists of a TypeScript class, an HTML template, and a CSS style...
Read more >
Component Templates in a Workspace Connected to Altium ...
When connected to an Altium 365 Workspace, note that Component Templates are not supported with the Altium Designer Standard Subscription. As ...
Read more >
3.3 Template Components - CT.gov
This section will give an overview of OpenRoads Template Components. ... Moving one point has no impact on the other points that make...
Read more >
Component Templates - Apache Tapestry
If a component does not have a template, but extends from a component class that does have a template, then the parent class'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found