本文整理汇总了TypeScript中vue.set函数的典型用法代码示例。如果您正苦于以下问题:TypeScript set函数的具体用法?TypeScript set怎么用?TypeScript set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: compiled
compiled() {
var options = this.$getAllChildren().filter((c: any) => {return 'SelectOption' == c.$options.name});
for (var i = 0; i < options.length; i++) {
var option = options[i];
var opt: any = this.createOption(option);
Vue.set(this.options, opt.value, opt);
}
}
开发者ID:Pandahisham,项目名称:material-components,代码行数:8,代码来源:index.ts
示例2: addCustomPokemonSet
export function addCustomPokemonSet(
state: State,
{ pokemon }: PokemonPayload
): void {
Vue.set(state.sets.custom[pokemon.gen], pokemon.id, {
"Custom Set": pokemon.toSet()
});
}
开发者ID:Sulcata,项目名称:Sulcata-Damage-Calculator,代码行数:8,代码来源:mutations.ts
示例3: modify
modify(index: number, column: IColumn): void {
if (this.$hub.currentSheet.columns[index].data != column.data
&& _.find(this.$hub.currentSheet.columns, {"data": column.data})) {
alert(`data="${column.data}" is already exists.`);
return;
}
let oldColumn: IColumn = this.$hub.currentSheet.columns[index];
if (column.data != oldColumn.data) {
for (let record of this.$hub.currentData) {
let data = _.get(record, oldColumn.data);
if (!_.isUndefined(data)) _.set(record, column.data, data);
_.unset(record, oldColumn.data);
}
}
if (column.type != "select") Vue.delete(column, "options");
if (!_.includes(["text", "select"], column.type)) Vue.delete(column, "json");
Vue.set(this.$hub.currentSheet.columns, index, column);
this.$hub.currentSheetMeta.modified = true;
}
开发者ID:nashika,项目名称:spreadsheet-code-generator,代码行数:19,代码来源:column.service.ts
示例4:
cssFontFamilies.forEach((val, i) => {
Vue.set(fontAvailability, val, result[i])
})
开发者ID:praycis-lee,项目名称:fonts.css,代码行数:3,代码来源:index.ts
示例5:
Object.keys(defaultProps).forEach(prop => {
if (!this.props.hasOwnProperty(prop)) {
Vue.set(this.props, prop, defaultProps[prop]);
}
});
开发者ID:ha-dai,项目名称:Misskey,代码行数:5,代码来源:define-widget.ts
示例6: dispatch
for (const slug of Object.keys(state.steps)) {
dispatch('evaluateStepCompletion', { slug, errors: false })
}
},
evaluateStepCompletion({ state, commit }, { slug, errors }: { slug: string, errors: boolean }) {
const step = state.steps[slug]
const finished = !errors && step.evaluateCompletion()
if (step.finished !== finished) {
commit(types.setStepFinished, { slug, value: finished })
}
}
}
export const mutations: MutationTree<State> = {
[types.updateField](state: State, { slug, section, field, value }: { slug: string, section: string, field: string, value: any }) {
Vue.set(state.steps[slug].sections[section].fields[field], 'model', value)
},
[types.setStepFinished](state: State, { slug, value }: { slug: string, value: boolean }) {
Vue.set(state.steps[slug], 'finished', value)
},
[types.fillStepsWithExistingData](state: State, { scholarFields, socialFields, privateFields }) {
for (let key of Object.keys(state.steps)) {
for (let section of state.steps[key].sections) {
for (let field of section.fields) {
if (privateFields[field.name]) {
field.model = privateFields[field.name].value;
} else if (scholarFields[field.name]) {
if (field.type === 'image') {
const url = scholarFields[field.name].value.downloadURL
field.model = { 0: url }
} else if (field.type === 'location') {
开发者ID:WWDCScholars,项目名称:WWDCScholars-form,代码行数:31,代码来源:steps.ts
示例7: fetchPost
},
actions: {
async fetchPost ({ commit, state }, slug) {
try {
const { data: post } = await fetchPost(slug)
commit('SET_POST', { slug, post })
} catch (err) {
console.log(err)
}
}
},
mutations: {
['SET_POST'] (state, { slug, post }) {
Vue.set(state.posts, slug, post)
}
}
}
export const createStore = () => new Vuex.Store<RootState>(store)
interface RootState {
version: string,
posts: {
[key: string]: Post
}
}
interface Post {
// slug: string,
html: string
开发者ID:yuler,项目名称:blog,代码行数:31,代码来源:index.ts
示例8:
_.forEach(setIds, (id) => {
Vue.set(state.statuses, id, state.statuses[id] || Status.Initial)
})
开发者ID:whitetrefoil,项目名称:flickr-simple-reorder,代码行数:3,代码来源:mutations.ts
示例9: debug
state.photosets = payload.photosets
// Set default status
const setIds = _.map(payload.photosets, _.property('id')) as string[]
if (state.statuses == null) { state.statuses = {} }
_.forEach(setIds, (id) => {
Vue.set(state.statuses, id, state.statuses[id] || Status.Initial)
})
},
[t.PHOTOSETS__SET_STATUS](state, { id, status }: ISetStatusPayload) {
debug(`Setting status of photoset ${id} to "${status}"`)
const photoset = _.find(state.photosets, _.matchesProperty('id', id))
if (photoset == null) {
debug(`no such photoset ${id} found!`)
return
}
Vue.set(state.statuses, id, status)
},
[t.PHOTOSETS__SET_PREFERENCE](state, payload: ISetPreference) {
state.preferences.orderBy = payload.orderBy
state.preferences.isDesc = payload.isDesc
Storage.set('preferences', {
f: state.preferences.orderBy,
o: state.preferences.isDesc,
})
},
}
开发者ID:whitetrefoil,项目名称:flickr-simple-reorder,代码行数:30,代码来源:mutations.ts
示例10: _setClasses
_setClasses (val) {
Vue.set(this.classes, 'active', val);
Vue.set(this.classes, 'fadeIn', val);
Vue.set(this.classes, 'fadeOut', !val);
}
开发者ID:Pandahisham,项目名称:material-components,代码行数:5,代码来源:index.ts
注:本文中的vue.set函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论