Comments (9)
It's actually expected behavior at the moment, adding a boolean value to something will make the actual value of it that boolean. It doesn't conditionally render.
The only item that is treated special is classes, for example:
<!-- array of classes in m-literal applies all of them during a build -->
<h1 m-literal:class="['bar', 'baz']">Foo</h1>
<!-- object of classes conditionally adds them -->
<h1 m-literal:class="{bar: true, baz: false}">Foo</h1>
I guess I can add behavior to the prop diff to conditionally add elements if they are a boolean. It'll be coming in v0.9.0.
from moon.
@kingpixil Many thanks for your prompt replies over the last day. I'm a user of VueJS, but the speed and size of your framework is really intriguing to me.
Might this conditional HTML attribute rendering also extend to things such as "checked" and "selected"?
from moon.
@bovisp No problem! I can't thank you enough for the great feedback you give, it really helps. After I fix a couple more bugs, v0.9.0 will be out! 🎉
Yup! The conditional HTML attributes work for anything provided as a boolean, including component properties as well!
from moon.
@kingpixil I'm happy to help. I'm in the process of creating some Moon examples using a codepen project. I'm basically retaking Laracasts' Vue 2.0 Step-by-Step and then Moon-ifying the resulting code. It will take me a while.
The project is in very rough shape right now and I only have four "hello world" type examples so far. They will be building in complexity as I move through the tutorials. I'll be renaming the HTML files and creating a landing page soon. The link is: https://codepen.io/tcdd/project/editor/ZoyVqA/
from moon.
And I was able to get conditional classes working via m-literal:class
with no issues using your API docs.
from moon.
That's super cool! Love the examples 👍
from moon.
Has this been fixed? Still having this issue with 0.10.0
from moon.
for (var nodePropName in nodeProps) {
var _vnodePropValue = vnodeProps[nodePropName];
if (_vnodePropValue === undefined || _vnodePropValue === false || _vnodePropValue === null) {
node.removeAttribute(nodePropName);
}
}
node.removeAttribute(nodePropName); is trying to remove property m-literal:disabled instead of disabled. Any idea how this is possible?
from moon.
Ahh, thank you for bringing this to my attention. The condition was removed in some previous commit, it should be fixed in v0.11.0.
from moon.
Related Issues (20)
- linking of mvl external file HOT 8
- Import libraries to use in components HOT 10
- Update Example HOT 5
- onCreate() doesn't have access to "this" HOT 7
- Q: Pass data to component? HOT 2
- Moon v1 Roadmap HOT 33
- awesome build-less moon (+lazy load components?) HOT 5
- is beta 3 production ready? HOT 2
- Common Editor Support for Syntax HOT 5
- Some attributes have to be set by attribute and not by DOM HOT 3
- Moon compiler does not apply DOM event listeners or attributes to created element by for HOT 4
- ubuntu 16 fasnetmoon HOT 2
- use moon in browser HOT 8
- How to apply DRY principles in example code HOT 3
- Any thoughts on hydrating data with SSR? HOT 3
- Fix environment variables on Windows HOT 1
- 没问题,只是开一下而已! HOT 2
- Just trying example - syntax error HOT 5
- How to reset recursive time driver HOT 3
- Is this project active or dead? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moon.