分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

Chrome 调用vue.js 记录

发布时间:2023-09-06 01:56责任编辑:白小东关键词:js

一、今晚遇到一个问题,就是不能直接在 html 直接调用 js 代码的问题

二、会出现如下错误:

 ???Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256- ???vKuX0yKlIAX3ZzZ9/PIUq7x1z425uZLu4glsP+4fqXM='), or a nonce ('nonce-...') is required to enable inline execution.

三、解决方法,就是将 js 代码写成单独的文件,然后包含进去即可。

 ???# index.html ???<!DOCTYPE html> ???<html> ?????<head> ???????<script src="js/vue.min.js"> </script> ?????</head> ???????<body> ???????<div id="chen_test_id1"> ?????????<p>{{ message }}</p> ???????</div> ???????<script src="js/test.js"> </script> ?????</body> ???</html>
 ???// js/test.js ???src="js/vue.min.js"> ???new Vue({ ?????el: '#chen_test_id1', ?????data: { ???????message: 'Hello Vue.js!' ?????} ???})

Chrome 调用vue.js 记录

原文地址:https://www.cnblogs.com/chenfulin5/p/9102878.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved