mikeabrahamsen / Flask-Meld

Flask-Meld is a library to provide server rendered templates over websockets for Flask applications to build reactive components without Javascript
https://www.flask-meld.dev/
MIT License
313 stars 15 forks source link

Erroron on load #40

Open systematicanet opened 3 years ago

systematicanet commented 3 years ago

Updated to the last flask-meld with pip. I have this error on loading of a page using meld component

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.

And then I'm not able to have a component working (with a previous version it work)

systematicanet commented 3 years ago

this is my code

selectmacroaree.py

class SelectMacroaree(Component):
    def __init__(self,  id=None, **kwargs):
        super().__init__(id=id, **kwargs)
        self.selezionato = kwargs.get('value', '0')
        myresult = listaMacroAreeDict()
        myresult.insert(0,{'id':0, 'text':'Tutte'})
        self.macroaree = myresult

    def set_macroarea(self):
        print(self.selezionato)

selectmacroaree.html

<div>
    <label for="selectmacroaree">Macroaree</label>
    <select meld:model.prevent="selezionato" meld:click="set_macroarea" class="uk-select" id="selectmacroaree" name="selectmacroaree"  >
        {% for macro in macroaree %}
            <option value="{{ macro.id|trim }}">{{ macro.text }}</option>
        {% endfor %}
    </select>
</div>

set_macroarea doesn't work