我正在使用vue-pdf和vue-server-renderer.在内部浏览页面时,它工作正常,但在重新加载时,webpack无法在vue-pdf模块中读取.vue文件.
vue-pdf/src/vuePdfNoSss.vue:1
(function (exports, require, module, __filename, __dirname) { <style src="./annotationLayer.css"></style>
^
SyntaxError: Unexpected token <
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function._load (/Users/aditya/rentomojo/node_module
Run Code Online (Sandbox Code Playgroud)
Webpack配置
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
Run Code Online (Sandbox Code Playgroud)
编辑:
重现步骤:
我有以下html代码,在点击特定按钮我想要更改特定html元素的颜色.
<paper-button style="background:blue" class="blue"></paper-button>
<paper-button style="background:red" class="red"></paper-button>
Run Code Online (Sandbox Code Playgroud)
这是我的剧本
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".blue, .red").click(function(){
$(".abc").css("background-color", $(".blue, .red").css("background-color"));
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
单击这两个按钮时,该元素的颜色会发生变化,但会变为蓝色而不会变为红色.当我将我的代码更改为
<paper-button style="background:red" class="red"></paper-button>
<paper-button style="background:blue" class="blue"></paper-button>
Run Code Online (Sandbox Code Playgroud)
在这种情况下,无论按下按钮,颜色都会变为红色.如何确保颜色更改为按下的按钮.