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

Make use of Vue more universal #2318

Merged
merged 1 commit into from
Aug 17, 2017
Merged

Conversation

Morlinest
Copy link
Member

Init Vue on any page where exists element with id="app". Don't need to create new Vue() for each page. Vue components should be used for logic.

@lunny lunny added the topic/ui Change the appearance of the Gitea UI label Aug 17, 2017
@lunny lunny added this to the 1.2.0 milestone Aug 17, 2017
@lunny
Copy link
Member

lunny commented Aug 17, 2017

LGTM

@tboerger tboerger added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Aug 17, 2017
@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Aug 17, 2017
@lafriks
Copy link
Member

lafriks commented Aug 17, 2017

How would you handle multiple places of Vue components in single page. Probably change to class vue-app and loop throu them and create Vue for each of them would be better?

Copy link
Member

@lafriks lafriks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment

@Morlinest
Copy link
Member Author

@lafriks I think we should use only 1 Vue instance on page and we can use any number of components (globally registered) inside. If your logic is inside component, we don't need more instances of Vue. Just set id on wrapping element. It is not best solution, but we have simple pages and it's ok with few components. For bigger project you would need use of some bundler like webpack.

@lafriks
Copy link
Member

lafriks commented Aug 17, 2017

Than probably just set I'd id=app globally to body element

@lafriks
Copy link
Member

lafriks commented Aug 17, 2017

As for webpack I think there was already issue for that or at least it was talked somewhere that it should be used

@Morlinest
Copy link
Member Author

@lafriks Yes, id="app" on body element is my future goal. But for now, we don't need to do it. Waiting for more components on more pages.

@lafriks
Copy link
Member

lafriks commented Aug 17, 2017

@Morlinest I already have PR for other component so if you would add Vue app to body I could change my PR to use that

@Morlinest
Copy link
Member Author

@lafriks I've found I can't do it right now because my template is included in script tag and template can not be inside app. There is no space (without refactoring) between included scripts and end of page (footer.tmpl contains both). How do you create/include component templates?

@Morlinest
Copy link
Member Author

If #2317 will be merged and we add language data as resource, than we can add template to js in index.js or create some bundle with components like components.js.

@lafriks
Copy link
Member

lafriks commented Aug 17, 2017

ok, let's leave like it is currently. Later in 1.3 we can do more refactoring

@lafriks
Copy link
Member

lafriks commented Aug 17, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 17, 2017
@lafriks lafriks merged commit f348636 into go-gitea:master Aug 17, 2017
@Morlinest Morlinest deleted the improve-vue-usage branch August 17, 2017 16:10
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants