我正在使用以下方法绑定 html 并显示在我的页面中。它工作完美,但是我收到来自 eslint 的警告,“v-html”指令可能导致 XSS 攻击。eslint(vue/no-v-html)
<button
id="foreignerBtn"
class="tabButton"
@click="foreignerClick"
v-html="textContent2"
></button>
Run Code Online (Sandbox Code Playgroud)
然后我按照以下方法更改它。但我无法渲染 html 标签。
<button
id="foreignerBtn"
class="tabButton"
@click="foreignerClick"
>{{ textContent2 }}</button>
Run Code Online (Sandbox Code Playgroud) 目前我正在我的页面中开发 SAPUI5 应用程序。我必须根据微服务的数据动态创建组合框。
\n\n我按照以下网址中的示例代码进行操作。\n查看源:https ://sapui5.hana.ondemand.com/test-resources/sap/m/ComboBox.html
\n\n但是,它在我的组合框中返回空
\n\n以下是我的示例代码。
\n\n$.ajax({\n url: "json/customers.json", \n dataType: \'json\',\n success: function(response){\n var data= response; \n console.log(data);\n var customerModel = new JSONModel(data);\n console.log(customerModel);\n oController.getView().setModel(customerModel, "customerJSON");\n var ExtensionForm = oController.getView().byId("Extension_Form");\n\n ExtensionForm.addContent(new sap.m.ComboBox(oController.getView().createId(\xe2\x80\x9cExtensionLabelId\xe2\x80\x9d), {\n items: {\n path: "{ComboBoxModel>/}",\n template: new sap.ui.core.Item({\n key: "{ComboBoxModel>CUSTOMER_NAME}",\n text: "{ComboBoxModel>CUSTOMER_NAME}"\n })\n },\n value : "{model2>/"+ keys[i] + "/fieldvalue}",\n enabled: false\n }));\n },\n error: function(error)\n {\n console.log("Error Message : " + JSON.stringify(error));\n }\n });\nRun Code Online (Sandbox Code Playgroud)\n 当我在打字稿中调用另一个函数时,我遇到了以下问题
此表达式不可调用。类型 '{ getUserInfo(requestData: object): Promise; }' 没有调用签名。在我的 index.ts
索引.ts
const fetchApiData = await getUserInfo(requestData)
Run Code Online (Sandbox Code Playgroud)
服务.ts
import { userInfoApi } from '../constants/api'
import request from '../utils/request'
export default {
async getUserInfo(requestData: object): Promise<object> {
return await request(userInfoApi, requestData, 'GET')
},
}
Run Code Online (Sandbox Code Playgroud)
请求文件
const request = (operation: string, data: object, method: any): Promise<object> => {
return new Promise(function(resolve, reject) {
my.request({
url: operation,
data: data,
method: method,
success: function(res) {
resolve(res)
},
fail: function(err) {
reject(err)
},
})
})
}
export …Run Code Online (Sandbox Code Playgroud) 在我的 ag 网格的每一行中。我需要在 ag-grid 的每一行中添加有角度的材质图标按钮。但是,结果只显示了文本按钮。它不会在我的 ag-grid 中显示我的图标按钮。
接下来,我需要在我的 ag-grid 中设置多选复选框。但是,在我的 ag-grid 中只能选择一行。如何在 ag-grid 列表中实现多选行。
以下是我的源代码。
constructor() {
this.gridOptions = <GridOptions>{
paginationPageSize: 18,
animateRows: true,
};
this.gridOptions.columnDefs = [
{
field: "",
width: 110,
checkboxSelection: true
},
{
headerName: "Distributor Code",
field: "dist_code",
width: 330,
sortingOrder: ["asc", "desc"]
},
{
headerName: "Distributor Name",
field: "dist_name",
width: 330,
sortingOrder: ["asc", "desc"]
},
{
headerName: "Status",
field: "status",
width: 330,
sortingOrder: ["asc", "desc"],
},
{
field: "",
width: 110,
cellRenderer: function clickNextRendererFunc(){
return …Run Code Online (Sandbox Code Playgroud) 目前,我正在创建一个包含图像数据和 JSON 数据的表单。我使用 2 post 方法将图像数据和 JSON 数据分别发布到我的 Nodejs 后端。是否有任何可能的解决方案使我能够仅通过使用 axios 和使用 Nodejs 的后端来发布一次图像和 JSON 数据。
以下是我的代码。
前端vue.js
submitAuth() {
console.log(this.promo.bannerImg)
const formData = new FormData()
formData.append('bannerImg', this.promo.bannerImg)
formData.append('inAppImg', this.promo.inAppImg)
formData.append('inAppImg', this.promo)
axios.post(`http://localhost:5000/success`,
this.promo
)
.then(response => {
console.log('Submit Success')
})
.catch(e => {
console.log('Submit Fail')
})
axios.post('http://localhost:5000/uploadImg',
formData
).then(response => {
console.log('Submit Success')
}).catch(e => {
console.log('Submit Fail')
})
},
Run Code Online (Sandbox Code Playgroud)
},
后端node.js
app.post("/success", function (request, response) {
co(function* () {
var promouid = request.body.uid
var filename = …Run Code Online (Sandbox Code Playgroud) 我尝试将"\"字符替换为空"",但我不能这样做.怎么解决?
这是我的代码
abc = abc.replace('\','');
Run Code Online (Sandbox Code Playgroud) 我有字符串对象,但存储在另一个类的变量传递中.如何在两个对象之间添加逗号,而不是最后一个对象.以下是我的代码.
{
"id":"57e4d12e53a5a",
"body":"asdas",
"published":"Fri,
23 Sep 2016 06:52:30 +0000",
"type":"chat-message",
"actor":
{
"displayName":"beau",
"objectType":"person",
"image":
{
"url":"http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=80&d=mm&r=g",
"width":48,"height":48
}
}
}
{
"id":"57e4d51165d97",
"body":"jackiechanSADAS",
"published":"Fri, 23 Sep 2016 07:09:05 +0000",
"type":"chat-message",
"actor":
{
"displayName":"beau",
"objectType":"person",
"image":
{
"url":"http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=80&d=mm&r=g",
"width":48,
"height":48
}
}
}
{
"id":"asas",
"body":"peterting",
"published":"Fri, 23 Sep 2016 07:09:05 +0000",
"type":"chat-message",
"actor":
{
"displayName":"beau",
"objectType":"person",
"image":
{
"url":"http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=80&d=mm&r=g",
"width":48,
"height":48
}
}
}
Run Code Online (Sandbox Code Playgroud)
如何通过使用编程在对象而不是最后一个对象之间添加逗号","因为整个事情我将它存储为字符串而没有","我无法将其解析为对象.
javascript ×5
typescript ×2
vue.js ×2
ag-grid ×1
ajax ×1
angular ×1
asynchronous ×1
axios ×1
data-binding ×1
eslint ×1
html ×1
json ×1
node.js ×1
object ×1
parsing ×1
post ×1
regex ×1
sapui5 ×1
service ×1