MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / stateMixin

Function stateMixin

06.Router/basic/js/vue.js:7830–8068  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

7828 });
7829
7830 function stateMixin (Vue) {
7831 /**
7832 * Accessor for `$data` property, since setting $data
7833 * requires observing the new object and updating
7834 * proxied properties.
7835 */
7836
7837 Object.defineProperty(Vue.prototype, '$data', {
7838 get: function get() {
7839 return this._data;
7840 },
7841 set: function set(newData) {
7842 if (newData !== this._data) {
7843 this._setData(newData);
7844 }
7845 }
7846 });
7847
7848 /**
7849 * Setup the scope of an instance, which contains:
7850 * - observed data
7851 * - computed properties
7852 * - user methods
7853 * - meta properties
7854 */
7855
7856 Vue.prototype._initState = function () {
7857 this._initProps();
7858 this._initMeta();
7859 this._initMethods();
7860 this._initData();
7861 this._initComputed();
7862 };
7863
7864 /**
7865 * Initialize props.
7866 */
7867
7868 Vue.prototype._initProps = function () {
7869 var options = this.$options;
7870 var el = options.el;
7871 var props = options.props;
7872 if (props && !el) {
7873 'development' !== 'production' && warn('Props will not be compiled if no `el` option is ' + 'provided at instantiation.', this);
7874 }
7875 // make sure to convert string selectors into element now
7876 el = options.el = query(el);
7877 this._propsUnlinkFn = el && el.nodeType === 1 && props
7878 // props must be linked in proper scope if inside v-for
7879 ? compileAndLinkProps(this, el, props, this._scope) : null;
7880 };
7881
7882 /**
7883 * Initialize the data.
7884 */
7885
7886 Vue.prototype._initData = function () {
7887 var dataFn = this.$options.data;

Callers 1

vue.jsFile · 0.70

Calls 10

warnFunction · 0.70
queryFunction · 0.70
compileAndLinkPropsFunction · 0.70
isPlainObjectFunction · 0.70
hasOwnFunction · 0.70
observeFunction · 0.70
isReservedFunction · 0.70
makeComputedGetterFunction · 0.70
bindFunction · 0.70
defineReactiveFunction · 0.70

Tested by

no test coverage detected