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
Checkbox with vue data array does not work. #1136
Comments
I will take a deep look. Have you tried this on a actual project or just on Codepen? |
I would like to use in my current project. For now, I'm working in a alternative to this using md-button-toggle. So, for now I only have this example in a JSFiddle. |
The codepen examples are broken. I'm fixing this right now. |
@Samuell1 even in browser, if we use the vue-material@beta with external references the same error occurs.
|
@marcosmoura I found my error using the previous version of beta version. It's necessary use md-value instead value. |
Can you check this now? Because the old version works with |
@marcosmoura could you tell me what's the url of the new version? The url https://unpkg.com/vue-material@beta throw an exception. |
Sorry @Samuell1 but this is not the solution. The reproduction link keep with the problem. The example that I wrote represents my scenario. If I need do something in this reproductions steps to solve the problem, could you tell me exactly what I should do please? |
@Samuell1 below is the same code that you wrote in codepen and not works for me. Could you tell me where I'm wrong please?
|
Its not same, try adding |
Same problem:
|
Script needs to have |
Same problem:
Could you past here the code that works for you please? |
that type needs to be only on javascript code not at source file |
I tried both before post. Could you write here the code that works please?
|
I using codepen. Do you get any errors in console? |
I'm not using codepen because I need work with this framework in my workspace. Every time show the same error message:
|
I checked it and there is issues with babel
Line 20:2 is Working example: <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link type="text/css" rel="stylesheet" href="https://unpkg.com/vue-material@beta/dist/vue-material.min.css">
<link type="text/css" rel="stylesheet" href="https://cdn.rawgit.com/vuematerial/vue-material/master/dist/default-theme.css">
<style>
.md-checkbox {
display: flex;
}
table {
width: 100%;
table-layout: fixed;
th {
text-align: left;
}
}
</style>
</head>
<body>
<div id="app">
<div>
<md-checkbox v-model="array" value="1">Array</md-checkbox>
<md-checkbox v-model="array" value="2">Array</md-checkbox>
<md-checkbox v-model="boolean">Boolean</md-checkbox>
<md-checkbox v-model="string" value="my-checkbox">String</md-checkbox>
<md-checkbox v-model="novalue">No Value</md-checkbox>
<md-checkbox v-model="disabled" disabled>Disabled</md-checkbox>
<table>
<tr>
<th>Array</th>
<th>Boolean</th>
<th>String</th>
<th>No Value</th>
</tr>
<tr>
<td>{{ array }}</td>
<td>{{ boolean }}</td>
<td>{{ string }}</td>
<td>{{ novalue }}</td>
</tr>
</table>
</div>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.js"></script>
<script type="text/javascript" src="https://unpkg.com/vue"></script>
<script type="text/javascript" src="https://unpkg.com/vue-material@beta"></script>
<script type="text/babel">
Vue.use(VueMaterial.default);
new Vue({
name: 'root',
el: '#app',
data: () => ({
array: [],
boolean: false,
string: null,
novalue: null,
disabled: true
})
});
</script>
</body>
</html> |
@Samuell1 thank you for your help. In fact the problem is with vue-material. If I only move the reference of vue-material to the end works:
|
@JaderCM problem was with destructing |
Steps to reproduce
Which browser?
Google Chrome version 62.0.3202.89 64 bits using VueMaterial 1.0.0-beta-4
What is expected?
Only the checked checkbox should be marked and the content of the property matrix binded to the checkbox should contain only the value of the checked checkbox. If another checkbox is checked, the array must also contain the checked value.
In summary, the array property must contain the value that represents the checked checkboxes.
What is actually happening?
Old version of VueMaterial: When any checkbox is checked all is checked (https://jsfiddle.net/JaderCM/2wt85dt5/)
Version 1.0.0-beta-4 of VueMaterial: The checkbox component is not rendered.
Reproduction Link
https://jsfiddle.net/JaderCM/2wt85dt5/7/
The text was updated successfully, but these errors were encountered: