Earlier quoted context omitted.
would you have preferred {{ for item in items | orderBy 'field' -1 }} ? I feel like you're getting hung-up on the fact that the template directive is also a valid attribute and not something similar to jinja - but that's just syntax
I don't really see much of a difference - that is still storing it as a text attribute inside a DOM node. To be clear, I vastly prefer Reacts approach of putting HTML into JS, rather than Vue/Angulars approach of putting JS into HTML.
Vue.js is Wikimedia Foundation's future JavaScript framework
111–120 of 204 posts
Re: Vue.js is Wikimedia Foundation's future JavaScript framework
#112I feel like I'm in an alien world when it comes to Vue - it has this weird pattern of making strings do loads of heavy lifting. The Github Commits[1] example on their documentation has a load of stuff that just doesn't sit right with me. Things like v-for="record in commits" to loop over something is insane to me - this isn't code, this is a string inside a html attribute! How can you get any sort of good type analys…
Re: Vue.js is Wikimedia Foundation's future JavaScript framework
#113Earlier quoted context omitted.
Vue is brilliant when you actually use it. Nothing you've mentioned is remotely ever a problem in my experience. Also :href="xxx" isn't a string, that is javascript in there. You won't ever have more than 10 characters at most in an attribute, and if you do you make a method for it and call the method. The other alternative is JSX type stuff in react where you are injecting full JS into the templates which is like co…
> :href="xxx" isn't a string, that is javascript in there. This is the part I don't really follow, though. Technically: href here isn't a string, it's python, but it's stored as a string, representing python. In the :href example for JS, that's not JS - an engine isn't seeing that - that's a string that is evaluated as JS at some point in the vue lifecycle.
Vue first parses the template into an AST in a process known as the template parsing:
function compile(template) {
const ast = parse(template)
transform(ast, transformations)
return generate(ast)
}Re: Vue.js is Wikimedia Foundation's future JavaScript framework
#114I feel like I'm in an alien world when it comes to Vue - it has this weird pattern of making strings do loads of heavy lifting. The Github Commits[1] example on their documentation has a load of stuff that just doesn't sit right with me. Things like v-for="record in commits" to loop over something is insane to me - this isn't code, this is a string inside a html attribute! How can you get any sort of good type analys…
Also modern component-based JS frameworks all work the same way. The UI definition is a template that's compiled into a render function which produces the final output during runtime. Each framework uses different syntax: React uses JSX which is a domain specific language (DSL) that mixes HTMl-like tags into Javascript. Vue uses HTML with directives on top. Angular, Svelte, etc all use their own formats.
You can even mix and match (use JSX with Vue) or write your own render function if you want, but it's the same text->parsing->lexing->compilation cycle that every language goes through before turning into actual CPU instructions.
Re: Vue.js is Wikimedia Foundation's future JavaScript framework
#115Congratulations to the Vue team, this is definitely a big win for them. Reading through the RFC is really interesting. They specifically call out the dependency on Facebook as effectively being React's Single Point of Failure, citing their negative experiences with HHVM. And for all of the love that people give React's big shifts (like hooks), the RFC specifically counts this against them, given that best practices h…
Although I understand what you saying about big shifts and kinda shared your opinion, specially about hooks, I started a new project from scratch last week and decided to give hooks a try (and, for reference, I've been using React on a daily basis for 5 years). Oh boy I was wrong. Hooks are way more easier and intuitive than what I thought. It makes code so much more readable and easier to reason about. Especially wh…
Re: Vue.js is Wikimedia Foundation's future JavaScript framework
#116Re: Vue.js is Wikimedia Foundation's future JavaScript framework
#117Wish Vue would just adopt JSX. Any web framework that invents another templating language force users to learn a whole new thing with it's own gotchas. So much unnecessary mental overload.
Re: Vue.js is Wikimedia Foundation's future JavaScript framework
#118* More complex, slower build process.
* Increased barrier for development.
* ECMAScript has been evolving so quickly lately that it will probably supersede Vue in the near future anyway. The true "futureproof" choice is to continue evolving with the latest ECMAScript spec.
Re: Vue.js is Wikimedia Foundation's future JavaScript framework
#119I feel like I'm in an alien world when it comes to Vue - it has this weird pattern of making strings do loads of heavy lifting. The Github Commits[1] example on their documentation has a load of stuff that just doesn't sit right with me. Things like v-for="record in commits" to loop over something is insane to me - this isn't code, this is a string inside a html attribute! How can you get any sort of good type analys…
All code is text. There is no pure "code" representation, text inside attributes being parsed as JS is no different than parsing text inside some tags. Also modern component-based JS frameworks all work the same way. The UI definition is a template that's compiled into a render function which produces the final output during runtime. Each framework uses different syntax: React uses JSX which is a domain specific lang…
It is different. Because "text inside script tags" is Javascript. Vue's templating syntax is a weird and inconsistent mishmash of custom DSL, Javascript subsets and Javascript expressions.
And it also depends on when it's parsed.
Re: Vue.js is Wikimedia Foundation's future JavaScript framework
#120Can I see the code for the TypeaheadSearch component somewhere? (I followed some links but didn't find it)
That currently lives here: https://github.com/wikimedia/wvui/tree/master/src/components... . This is WVUI, the component library created to serve the needs of the Desktop Improvements case study mentioned in the post here. Some of this code may change or get moved around based on the outcome of these tasks: https://phabricator.wikimedia.org/T286946
Reminds me of Backbone.js' views: https://backbonejs.org/#View