<script> export default { data() { return { id: '', baseUrl: '', ro:{ shipinmingcheng : false, shipinfengmian : false, shipin : false, yonghuming : false, xingming : false, fabushijian : false, sfsh : false, shhf : false, thumbsupnum : false, crazilynum : false, clicknum : false, }, type: '', userTableName: localStorage.getItem('UserTableName'), ruleForm: { shipinmingcheng: '', shipinfengmian: '', shipin: '', yonghuming: '', xingming: '', fabushijian: '', thumbsupnum: '', crazilynum: '', clicknum: '', }, rules: { shipinmingcheng: [ { required: true, message: '视频名称不能为空', trigger: 'blur' }, ], shipinfengmian: [ ], shipin: [ ], yonghuming: [ ], xingming: [ ], fabushijian: [ ], sfsh: [ ], shhf: [ ], thumbsupnum: [ { validator: this.$validate.isIntNumer, trigger: 'blur' }, ], crazilynum: [ { validator: this.$validate.isIntNumer, trigger: 'blur' }, ], clicknum: [ { validator: this.$validate.isIntNumer, trigger: 'blur' }, ], }, }; }, computed: {
时间: 2023-07-15 09:13:55 浏览: 111
这似乎是一个Vue.js的组件,其中包括一些data属性、methods、computed属性和rules。其中,data属性定义了组件内部的状态,包括一些表单项的值和校验规则;methods定义了一些响应用户操作的方法;computed属性则是通过计算已有的data属性来生成新的值;而rules则是用于校验表单项的规则。整个组件的作用可能是用于提交视频信息的表单,其中包括视频名称、封面、视频文件、发布时间、点赞数、疯狂点击数等信息。
相关问题
function generateReport() { try { var getUrl = window.location; var baseUrl = getUrl.protocol + "//" + getUrl.host + "/"; var url = baseUrl + 'polarion/ImpactAnalysisTree/ImpactAnalysisTree?projectId=' + projectId; var parameters = ""; var Id = false; var title = false; var workItemId = document.forms["tracegraph"]["itemId"]; if (workItemId != null) { if (!workItemId.value.trim().length == 0) { parameters = '&op=search&workItemId=' + workItemId.value; Id = true; } } if (!Id) { $(".widget-errors").text("Enter a valid Work Item ID /Title to generate traceability report.").show(); return false; } // AJAX 异步请求 $.ajax({ url: url + parameters, method: 'POST', success: function(response) { Data = JSON.parse(response); }, error: function(error) { console.log(error); alert(error); } }); } catch (e) { console.log(e); alert(e); } return false; } 根据返回的值重新渲染下面代码 <FORM id="tracegraph"> <br /> <form name="tracegraph"> <div id="inputDiv"> <table> <tr> <td valign="center" align="right">Work Item ID </td> <td> <div class="autocomplete"> <input id="itemId" type="text" name="itemId" autocomplete="off" placeholder="Work Item ID" style="width: 225px;"> </div> </td> </tr> </table> </div> </form> <table> <tr> <td> <button onclick="generateReport()" class="reportbutton" style="margin-left: 18px;" VALIGN=MIDDLE ALIGN=CENTER> Display Report</button> </td> </tr> </table> <br> <div class="widget-errors"></div> <div id="mainSVG"></div>
根据返回的值重新渲染下面代码:
```html
<FORM id="tracegraph">
<br />
<form name="tracegraph">
<div id="inputDiv">
<table>
<tr>
<td valign="center" align="right">Work Item ID </td>
<td>
<div class="autocomplete">
<input id="itemId" type="text" name="itemId" autocomplete="off" placeholder="Work Item ID" style="width: 225px;">
</div>
</td>
</tr>
</table>
</div>
</form>
<table>
<tr>
<td>
<button onclick="generateReport()" class="reportbutton" style="margin-left: 18px;" VALIGN=MIDDLE ALIGN=CENTER>Display Report</button>
</td>
</tr>
</table>
<br>
<div class="widget-errors"></div>
<div id="mainSVG"></div>
</FORM>
```
代码讲解<script> import wPicker from "@/components/w-picker/w-picker.vue"; import xiaEditor from '@/components/xia-editor/xia-editor'; import multipleSelect from "@/components/momo-multipleSelect/momo-multipleSelect"; export default { data() { return { cross:'', ruleForm: { xuehao: '', xueshengxingming: '', biaoti: '', tupian: '', liaotianneirong: '', fasongshijian: '', wodexuehao: '', wodexingming: '', shhf: '', }, xuehaoOptions: [], xuehaoIndex: 0, // 登录用户信息 user: {}, ro:{ xuehao : false, xueshengxingming : false, biaoti : false, tupian : false, liaotianneirong : false, fasongshijian : false, wodexuehao : false, wodexingming : false, shhf : false, }, } }, components: { wPicker, xiaEditor, multipleSelect }, computed: { baseUrl() { return this.$base.url; }, }, async onLoad(options) { this.ruleForm.fasongshijian = this.$utils.getCurDateTime(); let table = uni.getStorageSync("nowTable"); // 获取用户信息 let res = await this.$api.session(table); this.user = res.data; // ss读取 this.ruleForm.wodexuehao = this.user.xuehao this.ro.wodexuehao = true; this.ruleForm.wodexingming = this.user.xueshengxingming this.ro.wodexingming = true; // 下2 res = await this.$api.option(`xuesheng`,`xuehao`,{}); this.xuehaoOptions = res.data; // 如果有登录,获取登录后保存的userid this.ruleForm.userid = uni.getStorageSync("userid") if (options.refid) { // 如果上一级页面传递了refid,获取改refid数据信息 this.ruleForm.refid = options.refid; this.ruleForm.nickname = uni.getStorageSync("nickname"); } // 如果是更新操作
这是一个 Vue.js 的组件,其中引用了三个子组件:w-picker、xiaEditor 和 multipleSelect。在 data 中定义了一些变量,包括 cross、ruleForm、xuehaoOptions 等。其中 ruleForm 包含了一些表单数据,如 xuehao、xueshengxingming、biaoti 等。通过 computed 属性定义了 baseUrl 变量,通过 async onLoad 方法获取用户信息、选项等数据,并进行相应的赋值和判断。如果 options.refid 存在,则将其赋值给 ruleForm.refid,并将 nickname 读取出来。最后,根据更新操作进行相应的处理。
阅读全文