Home  >  Q&A  >  body text

javascript - <style lang="sass"></style> reports errors in js

<style lang="sass"></style>

import './sub.sass';

module.exports = function(){

var oBox =document.createElement('p')
oBox.className = 'p2'
oBox.innerHTML = 'form greet2'
return oBox

}

You can import, but you cannot write in js files
<style lang="sass">
</style>

PHP中文网PHP中文网2671 days ago849

reply all(2)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-06-26 10:53:05

    The

    <style> tag is an HTML tag, and of course it cannot be written in a JS file. Import is the new syntax of Javascript ES6, so it can be used directly.

    reply
    0
  • PHP中文网

    PHP中文网2017-06-26 10:53:05

    You can write it, for example in the vue component template, but if you write it this way, you need a corresponding loader to compile, load and recognize your special js file.

    reply
    0
  • Cancelreply